Java – jsonpath finds all objects (restassured)

This is my JSON:

[
{
    "id": 9741962,"name": "getName","isActive": true
},{
    "id": 1,"name": "New","isActive": true
}
]

I want to get all objects with names: getname using jsonpath how can I use jsonpath (with assured onw)

I'll try this

JsonPath.with(jsonResponse).get("findAll { a -> a.name == getName  }");

But I got it wrong

java.lang.IllegalArgumentException: No such property: sdfsdf for class: Script1

thank you.

Solution

OK, I find it necessary to add an apostrophe JsonPath. with(jsonResponse). get(“findAll {a – > a.name ==’getName’}”);

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>