我可以使用 JsonPath 按字符串过滤后反映结果的整个 json 吗?
- 在 JSON 之前
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
},
"expensive": 10
}
- JSON之后(我想要这个结果)
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
},
"expensive": 10
}
按字符串过滤书是通过 '$..book[?(@.author =~ /.*REES/i)]'
但是你能告诉我让整个 JSON 得到反映吗?