JSON 路径查询可能性



什么是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 在线评估器尝试这些查询时,这些查询不起作用,所以我想知道什么是正确的可能性集。

JSONPath 不是一种标准化的查询语言(也不是完全实现的) - XPath 是。

使用 DefiantJS (http:/defiantjs.com/),您可以使用 XPath 表达式查询 JSON 结构。要了解它的实际效果,请查看实时 XPath 评估器:

http://defiantjs.com/#xpath_evaluator

最新更新