[][src]Function jsonpath_lib::read

pub fn read(json: Value, path: &str) -> Result<Value, String>

Read Json using JsonPath

extern crate jsonpath_lib as jsonpath;
#[macro_use] extern crate serde_json;

let json_obj = json!({
"school": {
   "friends": [{"id": 0}, {"id": 1}]
},
"friends": [{"id": 0}, {"id": 1}]
});
let json = jsonpath::read(json_obj, "$..friends[0]").unwrap();
let ret = json!([ {"id": 0}, {"id": 0} ]);
assert_eq!(json, ret);