[−][src]Function jsonpath_lib::select
pub fn select(json: &Value, path: &str) -> Result<Value, String>
Select a JsonObject
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::select(&json_obj, "$..friends[0]").unwrap(); let ret = json!([ {"id": 0}, {"id": 0} ]); assert_eq!(json, ret);