jshift-derive
Procedural macros for jshift: schema-guided, 100% safe Rust JSON path reading, in-place mutation, and field projection on raw byte buffers.
jshift has blazing fast speeds when working with JSON data, +2x to +20000x speeds compared to serde 🚀
[!IMPORTANT] You almost never depend on this crate directly. Depend on
jshift(featurederiveis on by default); the macros are re-exported asjshift::JsonView/jshift::JsonMutatorSchema.
[]
= "0.4"
What it generates
On a struct with #[json(path = "...")] (and optional #[json(jmes = "...")]):
JsonView—read_from/write_into/project_bytesfor open partial documents (unmentioned keys stay unread and byte-preserved on write)read_from_json,mutator()+set_*/append_*helpersFIELD_PATHS,FIELD_JMES,INDEXED_ARRAY_PATHSproject_json,schema_project_plan, index-aware project helpers
use ;
// or #[derive(JsonView)]
let json = br#"{"id":7,"title":"Hat","images":[1,2,3]}"#;
let card = read_from_json.unwrap;
assert_eq!;
// `images` was never allocated into the struct (open projection)
Why jshift
When you only need a few paths on large or high-volume JSON (gateways, JSONL cleaners, bronze→silver cards), jshift path-scans and mutates the same Vec<u8> — no full AST allocate / re-serialize cycle. Safe Rust (forbid(unsafe_code)). See the main crate for the full story, benchmarks, and JMESPath subset projector:
https://crates.io/crates/jshift · GitHub
License
Licensed under either of Apache-2.0 or MIT, at your option (same as jshift).