我有一个如下的json
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95,
"version": 1
},
{
"category": "reference",
"author": "Nigel Reas",
"title": "Sayings of the Decade",
"price": 8.96,
"version": 2
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99,
"version": 1
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99,
"version": 2
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99,
"version": 3
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
},
"expensive": 10
}
现在我想根据两个属性过滤 json。
例如:$.store.book[?((@.category,@.version) in [('fiction',2),('reference',1)])]
但上述谓词不起作用。有没有办法做到这一点?