【发布时间】:2017-06-12 05:41:09
【问题描述】:
使用节点 JSONPath,如何从子节点值中获取父节点名称
{
"store": {
"book": [
{
"id":"1",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"id":"2",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}
]
}
}
我用这个表达式根据值来识别子节点,我想用这个子节点找到父节点
$.[?(@.id =="1")]
【问题讨论】:
-
您想返回您在其中找到
book的store?或者您想返回具有id的book?
标签: jsonpath