单个数组对象的jsonPath查询不工作
我有一个类似这样的JSON,如果我进行查询单个数组对象的jsonPath查询不工作,json,scala,gatling,jsonpath,Json,Scala,Gatling,Jsonpath,我有一个类似这样的JSON,如果我进行查询 jsonPath($.book[?(@.price)])是(“8.95”) {"book": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95 }, { "category": "fiction",
jsonPath($.book[?(@.price)])是(“8.95”)
{"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}
]
}
但是,如果JSON中只有一个对象,那么相同的查询逻辑将不起作用。i、 ejsonPath($.book[?(@.price)])是(“8.95”)
你知道为什么吗
{"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
}
]}
我需要坚持使用查询,因为我不确定API将返回多个对象还是单个对象。哦,我发现这是Gatling的错误,它无法解析带有大括号的查询的jsonPath,例如
{或[或)
哦,我发现这是Gatling的错误,它无法用带有括号的查询解析jsonPath,例如
{or]