lifegraph-json
Dependency-light JSON toolkit in Rust with owned, borrowed, tape, and compiled-schema paths.
Why
lifegraph-json is aimed at workloads where generic JSON trees leave performance on the table:
- fast parse-and-inspect flows
- low-allocation parsing
- repeated lookup on wide objects
- repeated serialization of known object shapes
It uses no external runtime dependencies.
Features
- manual JSON serializer
- owned parser
- borrowed parser
- tape parser for fast structural access
- lazy hashed object indexing
- compiled lookup keys for repeated field queries
- compiled object and row schemas for repeated-shape serialization
Example: tape parsing with compiled lookup keys
use ;
let input = r#"{"name":"hello","flag":true}"#;
let tape = parse_json_tape?;
let root = tape.root.unwrap;
let index = root.build_object_index.unwrap;
let indexed = root.with_index;
let keys = new;
let kinds = indexed
.get_compiled_many
.map
.;
assert_eq!;
# Ok::
Example: compiled row serialization
use ;
let schema = new;
let row1 = ;
let row2 = ;
let json = schema.to_json_string?;
assert_eq!;
# Ok::
Current performance direction
On local release-mode comparisons against serde_json, the strongest wins so far have been in specialized paths such as:
- tape parsing on medium/report-like payloads
- deep structural parses
- wide-object repeated lookup with indexed compiled keys
This crate is best viewed as a performance-oriented JSON toolkit for specific workloads, not a blanket replacement for serde_json.
Status
Current focus:
- correctness
- benchmarked fast parse and lookup paths
- zero/low-allocation access modes
- repeated-shape serialization