Reputation: 11
Lets say I have a JSON response that returns an array:
[
{
"username": "dude",
"id": 123456,
},
{
"username": "hello",
"id": 654321,
}
]
How would I grab an element in the array using using Rest-Assured? For example I would just want to grab the first element of the array and print it.
Upvotes: 0
Views: 1582
Reputation: 2609
Use following code
given()
.when()
.get()
.then().extract().path() // or .extract().jsonpath()
Upvotes: 1