【发布时间】:2020-11-04 10:02:51
【问题描述】:
使用以下 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
},
{ "category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
使用 JSONPath。是否有任何表达式只能获取所有价格低于 13.00 的书籍的键值对“作者”和“标题”。结果将类似于:
[{
"author": "Nigel Rees",
"title": "Sayings of the Century"
}, {
"author": "Evelyn Waugh",
"title": "Sword of Honour"
}, {
"author": "Herman Melville",
"title": "Moby Dick"
}
]
我从 $.store.book[?(@.price
【问题讨论】:
标签: filter expression key-value jsonpath