JSONPath queries
的可能性有多大。以下是我在 JSONPath - XPath for JSON
$.store.book[*].author
$..author
$.store.*
$.store..price
$..book[2]
$..book[(@.length-1)]
$..book[-1:]
$..book[0,1]
$..book[:2]
$..book[?(@.isbn)]
$..book[?(@.price<10)]
$..*
在JSONPath
$.data2.passes[0].id
$.store.bicycle.['dot.notation']
$.['store'].bicycle.['dot.notation']
$['store']['bicycle']['dot.notation']
$.['store']['bicycle']['dot.notation']
$.['store'].['bicycle'].['dot.notation']
$.['store'].bicycle.['dash-notation']
$['store']['bicycle']['dash-notation']
$.['store']['bicycle']['dash-notation']
$.['store'].['bicycle'].['dash-notation']
$.store.bicycle.foo:bar"
$['store']['bicycle']['foo:bar']
$.store
$.store.book[1]
$.store.book[*]
$.store.book[0,1]
$.store.book[0,1].author
$.store.book[*].author
$.['store'].['book'][*].['author']
$['store']['book'][*]['author']
$['store'].book[*]['author']
$..author
$.store.*
$.[0].[0].author
$.[0][0].author
$.store..['display-price']
当我使用在线评估者JSONPath Online Evaluator尝试这些查询时,这些不起作用,所以我想知道什么是正确的可能性。
答案 0 :(得分:0)
JSONPath不是标准化的查询语言(也没有完全实现) - XPath是。
使用DefiantJS(http:/defiantjs.com/),您可以使用XPath表达式查询JSON结构。要查看它的实际效果,请查看实时XPath评估器: