jetro-core 0.5.12

jetro-core: parser, compiler, and VM for the Jetro JSON query language
Documentation
1
2
3
4
5
6
7
use jetro_core::Jetro;
fn main() {
    let j = Jetro::from_bytes(br#"{"x":[{"id":1,"total":99.0,"customer":{"name":"A","tier":"g"},"items":[{"qty":1,"price":99.0}]}]}"#.to_vec()).unwrap();
    println!("d: {:?}", j.collect(r#"$.x.map({a: id, b: total, lbl: f"{id}-{total}"})"#));
    println!("e: {:?}", j.collect(r#"$.x.map({a: id, b: total, c: customer.name, lbl: f"{id}-{total}"})"#));
    println!("f: {:?}", j.collect(r#"$.x.map({a: id, b: total, c: customer.name, d: items.map(qty*price).sum(), lbl: f"{id}-{total}"})"#));
}