So I consume data from a REST endpoint (which I don't have access to) that is badly formatted.
In particular, I receive a json object that actually is a list. What is the best way to deal with this? Can it be done with Jackson?
{
"list": {
"element 31012991428": {
"objId": 31012991428,
"color": "green"
},
"element 31012991444": {
"objId": 31012991444,
"color": "orange"
},
"element 3101298983": {
"objId": 3101298983,
"color": "red"
},
}
}
Ideally, I want to be able to parse it as follows:
Response.java
public class GetSucherResponse {
@JsonProperty("elements") //what goes here?
private List<Element> elements;
}
Element.java
public class Element {
@JsonProperty("objId")
private Long objId;
@JsonProperty("color")
private String color;
}