In an API when making a GET call, I am able to convert the response into its representation in a java object.
{
"Id": "3-4779-841c-08f88e1d3889",
"Data": "{'name':'nombre','city':'ciudad'}"
}
final HttpResponseBean httpResponseBean = this.httpIntegrator.getRequest(
MessageFormat.format(
Dao.URL_PATTERN
, this.Scheme
, this.Url
, this.Port
, Dao.CONTEXT_PATH));
final byte[] payload = httpResponseBean.getPayload();
return mapper.readValue(payload, Bean.class);
This works perfectly but now I have to handle the response I get from a GET. But this time instead of managing to return a single value, I get the entire list of values. If I am able to map an object how could I map a response which I have an array of those objects in JSON format
[
{
"Id": "3-4779-841c-08f88e1d3889",
"Data": "{'name':'nombre','city':'ciudad'}"
},
{
"Id": "3-4779-841c-98f28e1d3689",
"Data": "{'name':'nombre','city':'ciudad'}"
},
{
"Id": "3-0729-891c-08f48s1d3889",
"Data": "{'name':'nombre','city':'ciudad'}"
},
]
Well the flow is like the one above, the GET request is made and with the response the following is done: