You need another POJO that represents a "CustomFields". For example:
public class CustomFields {
private String Id;
private String Name;
private String Value;
<getters and setters>
}
and use List<CustomFields> CustomFields instead of String[] customFields. Also note that your JSON example doesn't use camel case for the property names so your POJO shouldn't use camel case either.
There are ways to avoid using a POJO at all in REST Assured. You can for example use a HashMap instead which could be easier in some situations.
Answer from Johan on Stack OverflowGroTechMinds
grotechminds.com โบ home โบ creating and using pojo classes in restassured for api testing
Creating and Using POJO Classes in RestAssured for API Testing
February 27, 2025 - We have to serialize the value ... The ObjectMapper class belongs to the Jackson data-bind package. It provides functionality for reading and writing JSON, either to and from basic POJOs (Plain Old Java Objects)....
Videos
29:37
Mastering POJO in API Automation with Rest Assured - Java Tutorial ...
07:06
#23. |Rest Assured Framework | Deserialize Response To POJO & Compare ...
11:30
#19. |Rest Assured Framework| Use POJO To Create Request Payload ...
31:18
How To Send Complex Payload As Object -POJO Serialization in Rest ...
10:15
Part 15 - Deserializing to POJO class for complex JSON response ...
05:57
Part 20 - Serializing POJO classes to JSON object in RestAssured ...
Makeseleniumeasy
makeseleniumeasy.com โบ 2020 โบ 06 โบ 08 โบ rest-assured-tutorial-29-how-to-create-pojo-classes-of-a-json-payload
REST Assured Tutorial 29 โ How to create POJO classes of a JSON Object Payload
We will create a JSON object form POJO and vice versa now which is generally called as serialization and deserialization using Jackson APIs. Do not worry about the terms serialization and deserialization as of now as I have not covered it yet. For time being, you just know :- serialization โ Convert Employee class object to JSON representation or Object ยท deserialization โ reverse of serializing . Convert a JSON Object to Employee class object ยท package RestfulBookerPojo; import org.testng.annotations.Test; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.j
On Test Automation
ontestautomation.com โบ deserializing-pojos-in-rest-assured
(De)serializing POJOs in REST Assured | On Test Automation
October 5, 2016 - In this post, Iโd like to demonstrate how you can leverage the ability of REST Assured to (de-)serialize Plain Old Java Objects (better known as POJOs) for more powerful testing. As an example, weโll use the following POJO representing a car and some of its properties: public class Car { String make; String model; int year; public Car() { } public Car(String make, String model, int year) { this.make = make; this.model = model; this.year = year; } public String getMake() { return this.make; } public void setMake(String make) { this.make = make; } public String toString() { return "My car is a " + this.year + " " + this.make + " " + this.model; } }
Naukri
naukri.com โบ code360 โบ library โบ rest-assured--how-to-create-pojo-classes-of-a-json-payload
How to create POJO classes of a JSON Payload
Almost there... just a few more seconds
Medium
medium.com โบ @akshaymulay27 โบ pojo-objectmapper-in-rest-assured-the-easiest-guide-for-api-testers-with-real-examples-e1a91b893cb4
POJO & ObjectMapper in Rest Assured: The Easiest Guide for API Testers (With Real Examples) | by Akshay Mulay | Medium
May 8, 2025 - ๐ก User.class tells Java what type of object it should create from the JSON string. The cool part? Rest Assured can do all this automatically using your POJO class.
To The New
tothenew.com โบ home โบ pojo implementation in api testing (automation) using rest assured
POJO implementation in API testing (Automation) using Rest Assured | TO THE NEW Blog
September 22, 2025 - { // Import Statements for this Test class import org.testng.Assert; import org.testng.annotations.Test; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification;
YouTube
youtube.com โบ the testing academy
JSON to POJO Rest Assured | Deserializing JSON response to POJO class in RestAssured | Session 19 - YouTube
In this video, we are going to convert the JSON to POJO rest assured.https://www.jsonschema2pojo.org/#restassured #testautomation #apitesting #frameworkJoin ...
Published ย June 18, 2021 Views ย 4K
Top answer 1 of 6
46
You can do this:
List<Artwork> returnedArtworks = Arrays.asList(response.getBody().as(Artwork[].class));
The trick is to deserialize JSON to an array of objects (because there is no difference between the JSON string of an array or a list), then convert the array to a list.
2 of 6
15
this solution works for version 3.0.2 (io.restassured):
JsonPath jsonPath = RestAssured.given()
.when()
.get("/order")
.then()
.assertThat()
.statusCode(Response.Status.OK.getStatusCode())
.assertThat()
.extract().body().jsonPath();
List<Order> orders = jsonPath.getList("", Order.class);
This will extract the objects for a structure like this:
public class Order {
private String id;
public String getId(){
return id; }
public void setId(String id){
this.id = id;
}
}
with the given json:
[
{ "id" : "5" },
{ "id" : "6" }
]