【发布时间】:2015-05-24 01:03:04
【问题描述】:
这是我的 json:
{
'test': [
{ "id": "1", "description": "Test 1" },
{ "id": "2", "description": "Test 2" }
]
}
我正在尝试获取 id 的值,其中 description 是“测试 1”。
我在 JsonPath 页面上找到了以下示例:
$..book[?(@.price<10)]
尝试解析以下 jsonxpath 表达式时:
parse('$..test[?(@.description="Test 1")].id')
我收到以下错误:
jsonpath_rw.lexer.JsonPathLexerError: Error on line 1, col 7: Unexpected character: ?
我做错了什么?或者,有没有更好的方法来做到这一点?
【问题讨论】:
-
奇怪的是,看看lexer code,jsonpath-rw 似乎根本不支持
?(boolean)过滤机制。