Registry / serialization / ujson
library5.13.0pypypi✓ verified 26d ago

UltraJSON (ujson) is an ultra-fast JSON encoder and decoder for Python, implemented in pure C with Python bindings. It focuses on performance for serialization and deserialization tasks. As of version 5.12.0, the project is in a maintenance-only mode due to architectural challenges in making changes without introducing security vulnerabilities. Support for new Python versions and critical bug/security fixes will continue, but other changes are generally rejected.

pip install ujson
INSTALL
IMPORT
SIG · UJSON
U
ujson
serializationpythonv5.13.0
Install
1.7s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 18MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ujson
import ujson

This example demonstrates how to encode a Python dictionary into a JSON string using `ujson.dumps()` and then decode a JSON string back into a Python dictionary using `ujson.loads()`.

import ujson data = { "name": "Alice", "age": 30, "is_student": False, "courses": ["Math", "Science"], "address": None } # Encode Python dict to JSON string json_string = ujson.dumps(data, indent=4) # indent for pretty-printing print("Encoded JSON:", json_string) # Decode JSON string to Python dict decoded_data = ujson.loads(json_string) print("Decoded data:", decoded_data) print("Type of decoded_data:", type(decoded_data))
Debug
Known issues
breakingAs of v5.9.0, if a custom `toDict()` method on an object returns a non-dictionary type, it will now raise a `TypeError` instead of silently converting the value to `null`.
fix
Ensure that any custom `toDict()` implementation always returns a dictionary, or handle the `TypeError` appropriately.
affects: >=5.9.0
breakingAs of v5.9.0, boolean dictionary keys are now serialized using lowercase strings ('true'/'false') instead of potentially mixed case strings. This changes the output JSON structure for such keys.
fix
Update parsers or consumers of ujson output to expect lowercase boolean strings for dictionary keys.
affects: >=5.9.0
breakingAs of v5.11.0, `ujson.loads()` now consistently raises a `JSONDecodeError` for parsing issues, aligning with the standard library's `json` module. Previously, it might have raised a `SystemError` in some error scenarios.
fix
Update error handling blocks to catch `JSONDecodeError` (or its base class `ValueError`) instead of `SystemError` for JSON parsing failures.
affects: >=5.11.0
deprecatedSupport for Python 3.9 was dropped in v5.12.0.
fix
Upgrade to Python 3.10 or newer. For projects requiring Python 3.9, pin ujson to `<5.12.0`.
affects: >=5.12.0
deprecatedSupport for Python 3.8 and EOL PyPy3.8-PyPy3.10 was dropped in v5.11.0.
fix
Upgrade to Python 3.9 or newer, or PyPy3.11 or newer. For projects requiring these EOL versions, pin ujson to `<5.11.0`.
affects: >=5.11.0
gotchaUltraJSON is in maintenance mode due to its C architecture being prone to security vulnerabilities like buffer overflows. Users are encouraged to consider alternatives like `orjson` which offers similar performance with potentially better security characteristics.
fix
Evaluate migrating to `orjson` for new projects or existing projects where security is a paramount concern.
affects: All versions
gotchaPrevious versions (pre-5.4.0 and pre-5.3.0) had critical bugs including CVEs related to buffer overflows, double-frees, and various segmentation faults/memory leaks during error handling or with specific data types (e.g., large integers, non-string dict keys). While many of these have been fixed, they highlight the library's potential for low-level issues.
fix
Ensure you are using the latest stable version of ujson (5.12.0 or newer) to benefit from security and stability fixes.
affects: <5.4.0, <5.3.0
Upgrade
Version history
5.13.0latest on PyPI · released Jun 14, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer.
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
ujson — pip install ujson · libregistry