给出以下json,
{
"store": {
"book": [
{
"category": "reference",
"sub" : {"notRequired": "value1", "required": "value2"}
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"sub" : {"notRequired": "value1", "required": "value2"}
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}]
}
}
预期输出为:
[
{
"category" : "reference",
"sub" : {"required": "value2"}
},
{
"category" : "fiction",
"sub" : {"required": "value2"}
}
]
我尝试了以下变化:
$.store.book[*]['category', 'sub']
给出了sub
和$.store.book[*]['category', 'sub.required']
的所有属性,这些属性与任何嵌套的必需属性都不匹配。