I found a way to achieve what I wanted:

List<Person> persons = given().when().get("person/").as(Person[].class);

UPDATE: Using Rest-Assured 1.8.1, looks like cast to List is not supported anymore. You need to declare and object array like this:

Person[] persons = given().when().get("person/").as(Person[].class);
Answer from spg on Stack Overflow
🌐
TOOLSQA
toolsqa.com › rest-assured › deserialize-json-array
Deserialize JSON Array to List - Rest-Assured
We all are familiar with Serialization and De-serialization support built-in in Rest-Assured. Let us try to convert the searched nodes directly into an object representation. In this example let us retrieve all the books from the JSON response. We will retrieve all the books as a List of Books ...
🌐
Ham1
blog.ham1.co.uk › 2017 › 12 › 31 › rest-assured-extract-json-to-list
Rest Assured - Extract JSON to Java List - Graham Russell's Blog
December 31, 2017 - If I’ve not used Rest Assured for a while I always forget how to extract a Java List, and not an Array, from a JSON API response. It’s fairly easy, you just have to remember to use jsonPath rather than as.
🌐
YouTube
youtube.com › watch
40. Convert JSON Array API Response to Java List to extract values in Rest Assured - YouTube
Hey Guys,We need to perform assertions of values in API Response. To assert that a specific value from the response body we need to extract them. There are m...
Published   May 31, 2021
Top answer
1 of 4
5

If you need to get a value from response json list, here's what worked for me:

Json sample:
[
  {
    "first": "one",
    "second": "two",
    "third": "three"
  }
]

Code:

String first =
given
  .contentType(ContentType.JSON)
.when()
  .get("url")
.then()
.extract().response().body().path("[0].first")
2 of 4
1

Actually, you can but... you need to handle deserialization issue of default mapper becase if you try do the following:

.extract().jsonPath().getList("findAll {it.productName == " + productName + "}", Card.class);

You will failing on converting HashMap to your object type. It happens because of using gpath expression in path provides json without double quotes on keys by default. So you need to prettify it with (you can put it in RestAssured defaults):

.extract().jsonPath().using((GsonObjectMapperFactory) (aClass, s) -> new GsonBuilder().setPrettyPrinting().create())

And as result your would be able to cast things like that:

.getObject("findAll {it.productName == 'productName'}.find {it.tariffPlanName.contains('tariffPlanName')}", Card.class)

See full example:

import com.google.gson.GsonBuilder;
import io.restassured.http.ContentType;
import io.restassured.mapper.factory.GsonObjectMapperFactory;
import lombok.Data;
import org.testng.annotations.Test;

import java.util.HashMap;
import java.util.List;

import static io.restassured.RestAssured.given;

public class TestLogging {

    @Test
    public void apiTest(){
        List<Item> list = given()
                .contentType(ContentType.JSON)
                .when()
                .get("https://jsonplaceholder.typicode.com/posts")
                .then().log().all()
                .extract().jsonPath().using((GsonObjectMapperFactory) (aClass, s) -> new GsonBuilder().setPrettyPrinting().create())
                .getList("findAll {it.userId == 6}.findAll {it.title.contains('sit')}", Item.class);
        list.forEach(System.out::println);
    }

    @Data
    class Item {
        private String userId;
        private String id;
        private String title;
        private String body;
    }
}
🌐
DevQA
devqa.io › parse-json-response-rest-assured
How to Parse JSON Response with REST-assured - DevQA.io
List<String> jsonResponse = response.jsonPath().getList("username"); System.out.println(jsonResponse.get(0));
🌐
James Willett
james-willett.com › rest-assured-extract-json-response
Extracting a JSON Response with REST Assured | James Willett
June 16, 2015 - In the above code, we use Rest-Assured to convert our ‘jsonAsString’ String into an ArrayList of Map<String,?> called ‘jsonAsArrayList’. We then do an assertThat on the jsonAsArrayList to check that the size is equal to 3, the same as the number of entries in the JSON response.
🌐
TutorialsPoint
tutorialspoint.com › how-to-get-a-value-from-a-nested-list-in-rest-assured
How to get a value from a nested list in Rest Assured?
November 22, 2021 - import org.testng.annotations.Test; import static io.restassured.RestAssured.given; import java.util.ArrayList; import io.restassured.RestAssured; import io.restassured.http.ContentType; public class NewTest { @Test public void getRequest() { //base URL RestAssured.baseURI = "https://run.mocky.io/v3"; RestAssured.basePath = "/23ab8486-7d8d-41e4-be27-d603c767d745"; //response from GET request given() .when().get().prettyPrint(); //extract values from Response String name = given().contentType(ContentType.JSON).get() .then().extract().path("name"); System.out.println(name); String age = given().
🌐
Baeldung
baeldung.com › home › http client-side › getting and verifying response data with rest-assured
Getting and Verifying Response Data with REST-assured | Baeldung
October 26, 2025 - Movie[] movies = get(uri + "/movies").then() .statusCode(200) .extract() .as(Movie[].class); assertThat(movies.length).isEqualTo(2); In the previous section, we deserialized a JSON array of movies into a Java array of Movie objects using .as(Movie[].class). While this works, a more idiomatic approach in Java is to use a generic List. However, we can’t make a direct deserialization to a generic type like List.class because of Java’s type erasure. This is because REST Assured, which uses Jackson, can’t determine the generic type (Movie) at runtime.
Find elsewhere
🌐
Tabnine
tabnine.com › home page › code › java › io.restassured.path.json.jsonpath
io.restassured.path.json.JsonPath.getList java code examples | Tabnine
@Test public void testWithoutTenantIdParameter() { mockedQuery = setUpMockCaseInstanceQuery(Arrays.asList(MockProvider.createMockCaseInstance(null))); Response response = given() .queryParam("withoutTenantId", true) .then().expect() .statusCode(Status.OK.getStatusCode()) .when() .get(CASE_INSTANCE_QUERY_URL); verify(mockedQuery).withoutTenantId(); verify(mockedQuery).list(); String content = response.asString(); List<String> caseInstances = from(content).getList(""); assertThat(caseInstances).hasSize(1); String returnedTenantId1 = from(content).getString("[0].tenantId"); assertThat(returnedTenantId1).isEqualTo(null); }
🌐
Google Groups
groups.google.com › g › rest-assured › c › a0m6wKzzy6c
Deserializing JSON array of objects into POJO
List<Branch> branches = given().pathParam("id", branchId) .when() .get("/branches/{id}") .then() .extract() .jsonPath() .getList("data", Branch.class); /Johan ·  ·  · -- You received this message because you are subscribed to the Google Groups "REST assured" group.
🌐
Medium
medium.com › @kaweesha › api-automation-with-rest-assured-bd1e250a098c
API automation with REST Assured. REST Assured is a powerful Java API… | by kaweesha wijayawickrama | Medium
May 12, 2020 - Check REST Assured documentation for more types that you can pass as the request body. Here I have passed a java object as the request body. We can extract the values from the response body. Then use it in another method or verify it.
🌐
Javadoc.io
javadoc.io › doc › io.rest-assured › rest-assured › 3.0.5 › io › restassured › response › ResponseBodyExtractionOptions.html
ResponseBodyExtractionOptions - rest-assured 3.0.5 javadoc
https://javadoc.io/doc/io.rest-assured/rest-assured/3.0.5 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/io.rest-assured/rest-assured/3.0.5/package-list ·
🌐
Pavantestingtools
pavantestingtools.com › 2024 › 11 › extraction-from-json-in-rest-assured.html
SDET-QA Blog: Extraction from JSON in Rest Assured
Sometimes, you may want to extract ... uses users.name, where users is the array and name is the key we want to extract. Rest Assured returns all values for the name key in a List<String>....
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-transform-the-response-to-the-java-list-in-rest-assured
How to transform the response to the Java list in Rest Assured?
November 22, 2021 - import java.util.List; import org.testng.annotations.Test; import io.restassured.RestAssured; public class NewTest { @Test public void convertResponsetoList() { //base URL RestAssured.baseURI = "https://run.mocky.io/v3"; //convert JSON Response array to List List<Object> l = RestAssured //GET request on Mock URL .get("/1bb42856-4583-4c18-91ed-b9a6ab19efb4") .as(List.class); //size of List int s = l.size(); System.out.println("List size is: " + s); } }
🌐
TOOLSQA
toolsqa.com › rest-assured › read-json-response-body-using-rest-assured
How to Read Json Response Body using Rest Assured?
The output of the code passes the assertion and it also prints the City name retrieved from the Response. As shown in the image below · On the similar lines, you can extract any part of the Json response using the JsonPath implementation of Rest-Assured.
🌐
Medium
medium.com › @gauravverma.career › jsonpath-in-restassured-3eaea3ecd6ca
JsonPath in RestAssured. What is Rest Assured | by Gaurav Verma | Medium
December 5, 2025 - <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>5.5.0</version> <scope>test</scope> </dependency> JsonPath is a class in RestAssured that simplifies navigating and querying JSON data. It provides an easy way to extract values from a JSON response, especially when dealing with complex nested objects or arrays.
🌐
Javadoc.io
javadoc.io › doc › io.rest-assured › rest-assured › 3.0.1 › io › restassured › response › ExtractableResponse.html
ExtractableResponse - rest-assured 3.0.1 javadoc
https://javadoc.io/doc/io.rest-assured/rest-assured/3.0.1 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/io.rest-assured/rest-assured/3.0.1/package-list ·