json_walk 0.1.0

Access values in your JSON data using string paths (e.g. "result.item[0].value").
Documentation
pub mod file_handler;
pub mod json_path_parser;
pub mod json_value_locator;
use serde_json::Value;

pub fn json_walk(data: Value) -> json_value_locator::JsonValueLocator {
    json_value_locator::JsonValueLocator::new(data)
}

#[test]
pub fn test_walk() {
    use crate::file_handler::FileHandler;
    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");
    assert!(result.is_ok(), "{:#?}", result.err());
    assert_eq!(Value::String("apple".to_string()), result.unwrap())
}