我使用的是一个库,它反过来使用Jayway JSONPath。对于下面的JSON文件,我正确地引用了一个jsonpath $.location.city。
{
"venue":
{
"latitude": "51.0500000",
"longitude": "3.7166700"
},
"location":
{
"continent": " EU",
"country": "BE",
"city": "Brussels"
}
}但是我得到了错误"InvalidPathException com.jayway.jsonpath.PathNotFoundException: Missing property in path $['location']for $.location.city"。JSON路径有问题吗?
发布于 2022-02-20 06:00:14
如果使用jayway json-path库列表cityname = JsonPath.parse(response).read("$.location.city");
应用吊带匹配器,它应该有效。
https://stackoverflow.com/questions/34698868
复制相似问题