mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-07-31 07:12:05 +00:00
update READEME.md
This commit is contained in:
@@ -37,4 +37,29 @@ fn selector_mut() {
|
||||
.select().unwrap();
|
||||
|
||||
assert_eq!(vec![&json!("a"), &json!("a"), &json!("a"), &json!("a"), &json!("a")], result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn selector_mut_delete_array() {
|
||||
setup();
|
||||
|
||||
let json = serde_json::from_str(r#"{
|
||||
"school": {
|
||||
"friends": [
|
||||
{"name": "친구1", "age": 20},
|
||||
{"name": "친구2", "age": 20}
|
||||
]
|
||||
},
|
||||
"friends": [
|
||||
{"name": "친구3", "age": 30},
|
||||
{"name": "친구4"}
|
||||
]
|
||||
}"#).unwrap();
|
||||
|
||||
let json1 = jsonpath::delete(json, "$..friends[0]").unwrap();
|
||||
|
||||
println!("{:?}", json1);
|
||||
|
||||
let mut json2 = jsonpath::delete(json1, "$..friends[1]").unwrap();
|
||||
|
||||
}
|
Reference in New Issue
Block a user