jiter
Fast, iterable JSON parser powering Pydantic's Rust core
Repository Health
Technical Analysis
jiter is a high-performance JSON parser written in Rust, built as a fast alternative to the typical serde_json-based deserialization path with an emphasis on iterator-style, allocation-light parsing. It offers three complementary interfaces: a JsonValue enum for representing arbitrary parsed JSON, a Jiter iterator for streaming through JSON tokens against a known schema, and a PythonParse interface that parses JSON directly into native Python objects.
Developed by the Pydantic team, jiter is the JSON parsing engine underneath pydantic-core, giving Python’s most widely used data-validation library its JSON deserialization speed. Benchmarks in the repository show it substantially outperforming serde_json’s Value-based parsing across integers, floats, strings, and nested object workloads.
What You Get
- A
JsonValueenum representing parsed JSON as owned Rust data - A
Jiterstreaming iterator for schema-aware, allocation-light JSON traversal - A
PythonParseinterface that parses JSON strings directly into native Python objects via PyO3 - SIMD-accelerated parsing paths (e.g. simd_aarch64) for supported architectures
- Benchmark suite comparing throughput directly against serde_json across varied JSON shapes
Common Use Cases
- Powering JSON deserialization inside pydantic-core for Python data validation workloads
- Parsing large or performance-sensitive JSON payloads in a Rust service without serde_json’s Value overhead
- Streaming through known-schema JSON with the Jiter iterator to avoid materializing an intermediate value tree
- Building Python C-extension-backed tooling that needs fast JSON-to-Python-object conversion
Under The Hood
Architecture - jiter is a Cargo workspace with two published members: crates/jiter (the pure-Rust parsing core, ~7,600 lines across src/jiter.rs, src/parse.rs, src/value.rs, src/number_decoder.rs, and src/string_decoder.rs) and crates/jiter-python (PyO3 bindings exposing PythonParse and Python-object conversion via src/python.rs and src/py_string_cache.rs), plus an excluded crates/fuzz target for fuzz testing. Tech Stack - Written in Rust 2024 edition, using PyO3 for the Python bindings, with architecture-specific SIMD acceleration (src/simd_aarch64.rs) and an optional serde-compatible layer (src/serde.rs) for interop with the broader Rust JSON ecosystem. Code Quality - The crate has dedicated integration tests (tests/main.rs, tests/serde.rs, tests/python.rs), a benchmark suite directly comparing against serde_json across dozens of JSON payload shapes (benches/), and CodSpeed-based continuous performance tracking in CI, reflecting a strong emphasis on regression-free speed. API Design - The three-tier API (JsonValue for convenience, Jiter for zero-copy streaming, PythonParse for native Python interop) lets consumers pick the right trade-off between ergonomics and performance, documented with runnable examples on docs.rs.