I am trying to return the id of a declared variable from a json file: i want my java code to search for the previous variable in the json response and once it is found -> return the corresponding id. I am using RestAssured in java.
Json file response example:
[
{
"class" : "test 1",
"id" : 5,
"variable" : 87
},
{
"class" : "test 2",
"id" : 7,
"variable" : 76
}
]
Now, i do something like that but i have no idea:
Response response = given()
.config(config)
.header("accept","application")
.when()
.get("requestID")
.then()
.extract().response();
String id = String.valueOf(response.
body().
jsonPath().
get("id").toString().contains(variable));
Thank you