[][src]Function jsonpath_lib::select_as_str

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

Return to json string

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

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