Iam trying to store this JSON Response in an Object
[
{
"id": 52,
"disponibilita": 1,
"prezzo": 9
}
]
This is an Array and i am Creating a POJO Clss for it
private String id ;
private String prezzo ;
private String disponibilita ;
private String titolo;
In the main Method i am trying to create a object for the pojo class and deserialize it
poj = given().relaxedHTTPSValidation().header("Content-Type", "application/json")
.header("customerId", "xxx").header("S2S-Authorization", res4).expect()
.defaultParser(Parser.JSON).when()
.get("xxx").then()
.log().all().extract().response().as(pojode.class);
List<String> myList = poj.getAction();
System.out.println(myList);
Getting the Below Error
Exception in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of
Practise.pojode out of START_ARRAY token
You need to map json array []
to Java array or Collection.
pojode[] poj = given()...as(pojode[].class);
System.out.println(Arrays.toString(poj));