I have a valid JSON string of a ResponseEntity.class. Like this one:
{
"headers": {
"Location": ["/v1/books/12345"]
},
"body": {
"id": 12345,
"type": "BOOK",
"address": {
"address": "Some address",
"city": "Some city"
}
},
"statusCode": "CREATED",
"statusCodeValue": 201
}
I would like to create a ResponseEntity.class object from that string. I am using a standard Jackson mapper for that:
objectMapper.readValue(jsonString, ResponseEntity.class)
And get back a following error:
Can not construct instance of org.springframework.http.ResponseEntity: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
Indeed, when I checked the class, I did not see a default constructor there. How can I solve the issue and create an object?
ResponseEntityobject?