鉴于下面的JSON:
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century"
},
{
"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"
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": null,
"isbn": "0-395-19395-8",
"price": null
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
},
"expensive": 10
}
我可以使用哪条JSON路径来检索包含book
,category
,author
和price
参数的title
的第一个元素?要明确的是,我不希望任何 category
,author
,price
和title
参数 - 只有那些来自单书对象。此外,book
数组的结构也各不相同(即其元素的数量和配置随时间而变化),因此我无法对任何内容进行硬编码。
答案 0 :(得分:0)
我认为你的意思是:
$ .. book [?(@。category&& @ .author&& @ .price&& @ .title)]