json_walk 0.1.0

Access values in your JSON data using string paths (e.g. "result.item[0].value").
Documentation

JSON Walk

Access values in your JSON data using string paths (e.g. "result.item[0].value").

Installing

cargo add json_walk

Example:

use json_walk::{
    file_handler::FileHandler,
    json_walk
};
use serde_json::Value;
let data = FileHandler::load("storage/test-data/data.json").unwrap();
let walker = json_walk(data);

let result = walker.get("result.item[0].value");
// result.unwrap() -> "apple"

Supported Path Syntax

Pattern Meaning
a.b.c object key access
a[0] array index access
status top-level key
a[0].value array index the key access

TODO

  • Support obj["key"]
  • Support a.value\.1

License

See LICENSE for details.