orjson

3.11.7 · active · verified Sat Mar 28

orjson is a fast and correct Python JSON library supporting dataclasses, datetimes, and numpy. The current version is 3.11.7, released on March 28, 2026, with a release cadence of approximately every 3 months.

Warnings

Install

Imports

Quickstart

A simple example demonstrating serialization and deserialization using orjson.

import orjson

# Serialize a Python object to JSON
data = {'name': 'Alice', 'age': 30}
json_bytes = orjson.dumps(data)
json_str = json_bytes.decode('utf-8')
print(json_str)

# Deserialize JSON to a Python object
json_bytes = b'{"name":"Alice","age":30}'
parsed_data = orjson.loads(json_bytes)
print(parsed_data)

view raw JSON →