0

の可能性は何ですか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でこれらのクエリを試してみると、これらは機能しません。

4

1 に答える 1

0

JSONPath は標準化されたクエリ言語ではありません (完全に実装されているわけでもありません)。XPath はそうです。

DefiantJS (http:/defiantjs.com/) を使用すると、XPath 式で JSON 構造を照会できます。実際の動作を確認するには、ライブ XPath エバリュエーターをチェックしてください。

http://defiantjs.com/#xpath_evaluator

于 2014-05-18T22:39:11.530 に答える