java jsonpath查找所有对象(重新启动)
这是我的JSON:
[
{
"id": 9741962,
"name": "getName",
"isActive": true
},
{
"id": 1,
"name": "New",
"isActive": true
}
]
我想使用jsonPath获取所有名为getName的对象 如何使用JsonPath(rest-assured附带的onw)实现这一点
我试试这个
JsonPath.with(jsonResponse).get("findAll { a -> a.name == getName }");
但是我犯了一个错误
java.lang.IllegalArgumentException: No such property: sdfsdf for class: Script1
谢谢
# 1 楼答案
您需要设置参数。试一试
# 2 楼答案
好的,我找到了,需要加上撇号
JsonPath.with(jsonResponse).get("findAll { a -> a.name == 'getName' }");