I'm trying to consume a service that gives me an entity with a field that it's an array.
{
"id": "23233",
"items": [
{
"name": "item 1"
},
{
"name": "item 2"
}
]
}
But when the array contains a single item, the item itself is returned, instead of an array of one element.
{
"id": "43567",
"items": {
"name": "item only"
}
}
In this case, Jackson fails to convert to my Java object.
public class ResponseItem {
private String id;
private List<Item> items;
//Getters and setters...
}
Is there an straightforward solution for it?