How ijl/orjson works
orjson is a native Python JSON library: Python callers pass objects to dumps() for UTF-8 JSON bytes or to loads() for Python values. The graph separates the extension entry point, encoding, decoding, and Python-object/FFI support. The README documents native dataclass, datetime, NumPy, UUID, Fragment, and custom-default serialization; some of those implementation paths are represented by their source directories because their internals were not sampled. Edges reflect shown calls, source-index references, or README-documented behavior; unsampled internal details are not inferred.
Main entry points: lib.rs Extension API · mod.rs Serialization dispatch · container.rs Containers and defaults · deserializer.rs Decode orchestration
Components 20
Python API
- Extension API
src/lib.rs - Output options
src/opt.rs
JSON Encoding
- Serialization dispatch
src/serialize/mod.rs - Containers and defaults
src/serialize/writer/container.rs - JSON byte writer
src/serialize/writer/byteswriter.rs - Date and time
src/serialize/datetime.rs - NumPy encoding
src/serialize/numpy/array.rs - Special types
src/serialize - Fragment encoding
src/serialize/fragment.rs
JSON Decoding
- Decode orchestration
src/deserialize/deserializer.rs - Input handling
src/deserialize/input.rs - yyjson backend
src/deserialize/backend/yyjson.rs - Key cache
src/deserialize/cache.rs - Python value creation
src/deserialize/pyobject.rs
Python Interop
- CPython FFI
src/ffi/mod.rs - Type references
src/typeref.rs - Fragment type
src/ffi/fragment.rs
Other components
- Python caller
- Python values
- JSON bytes
Connections 20
- Python caller → Extension API: calls API
README.md - Extension API → Serialization dispatch: serializes with
src/lib.rs - Extension API → Decode orchestration: deserializes with
src/lib.rs - Extension API → Output options: exports flags
src/lib.rs - Serialization dispatch → Containers and defaults: dispatches values
src/serialize/mod.rs - Containers and defaults → JSON byte writer: writes JSON
src/serialize/writer/container.rs - Containers and defaults → Date and time: formats dates
src/serialize/writer/container.rs - Containers and defaults → Fragment encoding: serializes fragments
src/serialize/writer/container.rs - Serialization dispatch → NumPy encoding: supports NumPy
README.md - Serialization dispatch → Special types: supports native types
README.md - Serialization dispatch → Output options: applies flags
src/serialize/mod.rs - Extension API → JSON bytes: returns bytes
README.md - Decode orchestration → Input handling: reads input
src/deserialize/deserializer.rs - Decode orchestration → yyjson backend: parses JSON
src/deserialize/deserializer.rs - yyjson backend → Python value creation: builds values
src/deserialize/backend/yyjson.rs - yyjson backend → Key cache: uses key cache
- Decode orchestration → Python values: returns values
README.md - Extension API → CPython FFI: uses Python API
src/lib.rs - CPython FFI → Fragment type: registers type
src/ffi/mod.rs - Fragment type → Type references: uses type reference
src/ffi/fragment.rs