I want to print the value of "isbn" the in below JSON body using jayway.restassured.path.json.JsonPath and not by any other library. As you can see below, there is no name present for the given JSON array which is having only 1 element.
[
{
"isbn":"1849830547",
"title":"American Assassi",
"author":"Vince Flyn",
"price":7.99
}
]
Note: Consider I am already having the above JSON output in a String body and I am creating a JSONpath object as below JsonPath jsonPath = new JsonPath(body);
I have tried below things
String isbn= jsonPath.get("$[0].isbn");
String isbn= jsonPath.get("[0].isbn");
String isbn= jsonPath.get("isbn");
String isbn= jsonPath.get("$.isbn");
And none of the above worked for me