orjson
Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
Decision gist · record as of 2026-08-14
Yes. orjson is production-ready, actively maintained, widely used (top 1000 PyPI packages), and has zero known vulnerabilities. Install it if you need faster JSON performance or native serialization of dataclasses, datetime, or numpy objects. The copyleft license (MPL-2.0 + Apache-2.0 or MIT) requires review for proprietary projects, but is permissive for most open-source use. Medium install friction is acceptable given the pre-built wheels and broad platform coverage.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; orjson.dumps() returns bytes, not str like the standard json module.
- Medium install friction due to compiled wheels, but pre-built binaries are available for most platforms (Linux, macOS, Windows across multiple architectures).
- The package is actively maintained with a recent release and no known vulnerabilities.
License · maintenance · safety
MPL-2.0 AND (Apache-2.0 OR MIT) (copyleft) — Licensed under MPL-2.0 AND (Apache-2.0 OR MIT), a copyleft combination. Users must comply with the Mozilla Public License 2.0 terms alongside either Apache 2.0 or MIT; review your project's license compatibility before adopting.
last release 2026-05-06 (100 days) · last repo commit 2026-08-13 · 8,201 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 222,600,397 downloads/mo, #187 on PyPI
Alternatives
Verify before relying
import orjson
import datetime
data = {"timestamp": datetime.datetime(1970, 1, 1)}
bytes_output = orjson.dumps(data)
result = orjson.loads(bytes_output)
print(result)- Whether the performance claims (10x faster serialization, 2x faster deserialization vs json) remain accurate for your specific use case and data types.
- Compatibility with custom serialization logic if migrating from json.dumps with a custom default handler.
What it is and what it does
orjson is a drop-in replacement for Python's json module that prioritizes speed and correctness. It serializes to and deserializes from JSON bytes, with native support for Python types that the standard library doesn't handle—dataclasses, datetime objects, numpy arrays, and UUIDs—without requiring custom serializers. The library is written in Rust and compiled to native code, making it substantially faster than pure-Python implementations. It supports Python 3.10 through 3.15 and distributes pre-built wheels for Linux, macOS, and Windows across multiple CPU architectures.
The main trade-off is that orjson.dumps() returns bytes instead of a string, and it uses an options flag system (e.g., OPT_SORT_KEYS, OPT_INDENT_2) rather than keyword arguments like the standard library. It does not provide file I/O helpers; you handle reading and writing files yourself. The library is actively maintained, carries no known security vulnerabilities, and is licensed under a copyleft combination of MPL-2.0 and (Apache-2.0 OR MIT).
Use it for
- Replace json in web frameworks or APIs where serialization speed is a bottleneck and you need native datetime or dataclass support.
- Serialize numpy arrays or scientific data structures directly to JSON without manual conversion.
- Deserialize large JSON payloads where parsing speed matters, such as log aggregation or real-time data pipelines.
- Migrate from json.dumps when your codebase already uses dataclasses or datetime objects extensively.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
orjson is production-ready, actively maintained, widely used (top 1000 PyPI packages), and has zero known vulnerabilities. Install it if you need faster JSON performance or native serialization of dataclasses, datetime, or numpy objects. The copyleft license (MPL-2.0 + Apache-2.0 or MIT) requires review for proprietary projects, but is permissive for most open-source use. Medium install friction is acceptable given the pre-built wheels and broad platform coverage.
Install
orjson on PyPI
Before you install
Medium install friction due to compiled wheels, but pre-built binaries are available for most platforms (Linux, macOS, Windows across multiple architectures). The package is actively maintained with a recent release and no known vulnerabilities.
Requires Python 3.10 or later; orjson.dumps() returns bytes, not str like the standard json module.
License in practice
Licensed under MPL-2.0 AND (Apache-2.0 OR MIT), a copyleft combination. Users must comply with the Mozilla Public License 2.0 terms alongside either Apache 2.0 or MIT; review your project's license compatibility before adopting.
Quickstart
import orjson
import datetime
data = {"timestamp": datetime.datetime(1970, 1, 1)}
bytes_output = orjson.dumps(data)
result = orjson.loads(bytes_output)
print(result)
Verify before relying
- Whether the performance claims (10x faster serialization, 2x faster deserialization vs json) remain accurate for your specific use case and data types.
- Compatibility with custom serialization logic if migrating from json.dumps with a custom default handler.
Package facts
| License | MPL-2.0 AND (Apache-2.0 OR MIT) copyleft |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 100 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 222,600,397 / month, #187 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Operating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: Implementation :: CPythonProgramming Language :: RustTyping :: Typed |
Evidence: orjson-3.11.9-cp310-cp310-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl; orjson-3.11.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; orjson-3.11.9-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; orjson-3.11.9-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl; orjson-3.11.9-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; orjson-3.11.9-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; orjson-3.11.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; orjson-3.11.9-cp310-cp310-musllinux_1_2_aarch64.whl; orjson-3.11.9-cp310-cp310-musllinux_1_2_armv7l.whl; orjson-3.11.9-cp310-cp310-musllinux_1_2_i686.whl; orjson-3.11.9-cp310-cp310-musllinux_1_2_x86_64.whl; orjson-3.11.9-cp310-cp310-win32.whl; orjson-3.11.9-cp310-cp310-win_amd64.whl; orjson-3.11.9-cp311-cp311-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl; orjson-3.11.9-cp311-cp311-macosx_15_0_arm64.whl; orjson-3.11.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; orjson-3.11.9-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; orjson-3.11.9-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl; orjson-3.11.9-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; orjson-3.11.9-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “datetime json serialization”
- orjsonorjson is a fast JSON serialization and deserialization library that…
- json-encoderProvides JSON serialization with singledispatch-based type handlers…
- Flask-JSONFlask-JSON adds convenient JSON response generation and error…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Anyjson provides a uniform API for JSON serialization and deserialization by automatically selecting and wrapping the fastest available JSON library on the system.
Provides a high-performance JSON renderer and parser for Django REST Framework using orjson, a Rust-backed library, while maintaining pretty-printed output for the browsable API.
Install it if JSON performance is a concern; skip it if your API traffic is low or you have no performance issues with the default renderer.
ormsgpack is a fast MessagePack serialization library for Python that encodes and decodes objects to and from the MessagePack binary format, with native support for dataclasses, datetimes, and numpy arrays.
Install it if you need fast, type-aware MessagePack serialization for dataclasses, datetimes, or numpy arrays.
Replaces Flask's default JSON encoder with orjson, a faster JSON serialization library, to speed up JSON request parsing and response generation in Flask applications.
However, dormant maintenance means you should verify compatibility with your Flask and orjson versions before deploying to production, and be prepared to maintain a…
Loads JSON configuration files and provides dot-notation access to nested values, with built-in validation and transformation of field types and values.
However, the lack of a release since November 2019 means you should verify that the package works with your current Python and dependency versions before committing…
Patches Python's built-in `json` module to recognize and call a `__json__` method on custom classes during serialization, similar to JavaScript's `toJSON`.
However, the aging maintenance status (295 days since last release) suggests limited active development—install it only if the `__json__` pattern solves a specific…
See also json-strong-typing · numpyencoder · databind.json · py-serializable