[−][src]Function jsonpath_lib::delete
pub fn delete(value: Value, path: &str) -> Result<Value, JsonPathError>
Delete(= replace with null) the JSON property using the jsonpath.
extern crate jsonpath_lib as jsonpath; #[macro_use] extern crate serde_json; let json_obj = json!({ "school": { "friends": [ {"name": "친구1", "age": 20}, {"name": "친구2", "age": 20} ] }, "friends": [ {"name": "친구3", "age": 30}, {"name": "친구4"} ]}); let ret = jsonpath::delete(json_obj, "$..[?(20 == @.age)]").unwrap(); assert_eq!(ret, json!({ "school": { "friends": [ null, null ] }, "friends": [ {"name": "친구3", "age": 30}, {"name": "친구4"} ]}));