ultrajson/ultrajson logo

ultrajson/ultrajson

Free

Ultra fast JSON decoder and encoder written in C with Python bindings

FreeFree tier
Type
Open Source

About ultrajson/ultrajson

UltraJSON is a high-performance JSON encoder and decoder implemented in pure C with Python bindings. It serves as a drop-in replacement for Python's standard library json module, offering significant speed improvements for serialization and deserialization tasks. The library supports various encoding options including escaping HTML characters, ensuring ASCII output, controlling forward slash escaping, and enabling pretty-print indentation. Benchmarks demonstrate its performance against alternatives like orjson, simplejson, and the standard json module. Note: as of its latest maintenance release, UltraJSON's architecture is considered ill-suited for safe changes, and the project is in maintenance-only mode. Users are advised to migrate to orjson for new projects.

Key Features

Ultra fast JSON encoding and decoding in pure C with Python bindings
Drop-in replacement for Python's built-in json module
Supports encoder options: encode_html_chars, ensure_ascii, escape_forward_slashes, indent
Benchmarked against orjson, simplejson, and standard json

Pros & Cons

Pros
  • Significantly faster than Python's standard json module
  • Drop-in compatibility reduces migration effort
  • Multiple encoding options for various output requirements
  • Widely used and established library
Cons
  • Project is in maintenance-only mode with no new features
  • Architecture carries risk of introducing security vulnerabilities
  • Slower than orjson in benchmarks
  • Not recommended for new projects; users urged to migrate to orjson

Best For

High-performance JSON parsing and generation in Python applicationsWeb API data serialization and deserializationProcessing large JSON datasets in data pipelinesReplacing standard json module for speed-critical operations

FAQ

Is ujson still maintained?
UltraJSON is in maintenance-only mode. Critical bugs and security issues will be fixed, but no new features or enhancements will be added.
Should I use ujson or orjson for a new project?
The UltraJSON documentation recommends migrating to orjson, which is both faster and less likely to introduce security vulnerabilities.
How do I install ujson?
Install via pip: python -m pip install ujson