UltraJSON is a JSON encoder and decoder implemented in C with Python bindings, installable via pip and usable as a drop-in for many Python JSON APIs.
Overview
UltraJSON provides JSON encoding and decoding for Python through a C extension. It is intended to replace or mirror common Python JSON usage with configurable encoder behavior.
Encoder options include encoding unsafe HTML characters, limiting output to ASCII, escaping forward slashes, and optional pretty-print indentation. The project is in maintenance-only mode: new Python versions and critical security fixes continue, but other changes are declined in favor of migrating to orjson.
Benchmarks compare call rates against other Python JSON libraries on a Linux test host. The library has no global state, so calling it from multiple threads is thread safe, with caveats about mutating objects while another thread serializes them.
Optional build environment variables support keeping debug symbols and linking against an external double-conversion library for packagers.
Key features
- C extension JSON encode and decode
- Drop-in Python JSON replacement
- Configurable ASCII and HTML encoding
- Optional pretty-print indentation
- Thread-safe calls without global state
- pip installable package
Use cases
- Faster JSON serialization in Python
- High-throughput API JSON parsing
- Replacing stdlib json in hot paths
- Linux package builds with system libraries