进行筛选器查询时出现 Jsonpath 错误 - 'Parse error at %s:%s near token %s (%s)'



因此,在运行以下测试代码后:

from jsonpath_ng import parse
import json
dici = """
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{
"category": "fiction",
"author": "J.R.R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
},
"expensive": 10
}
"""
jayson = json.loads(dici)
a = [match.value for match in parse('$..book[?(@.price < 10)]').find(jayson)]

print(a)

引发异常("%s处的Parse错误:%s靠近标记%s(%s("%(t.lineno,t.col,t.value,t.type((异常:1:8时在令牌((((附近分析错误

我真的不知道发生了什么,如果有人能帮助我就太好了!谢谢

所以经过几天的搜索,我终于找到了修复程序。正如在这个github线程中所说,更改导入可以修复它。

最新更新