I am having a problem when I want to be able to map a single Object but also an Array of those object with com.fasterxml.jackson.annotation
Please see below example keep in mind that this is a response payload and it is not under my control:
{
"GetSomeUserInfoDetails": {
"ItemListOfUser": {
"itemList": {
"item": [
{
"name": "Stack overflow",
"adress": "ola"
},
{
"name": "Google",
"adress": "man"
}
]
}
}
}
}
The jsontopojo is generating the classes that I can use for this response. The problem occurs when there is only one item int itemList user i get the following response:
{
"GetSomeUserInfoDetails": {
"WorkItem": {
"itemList": {
"item": {
"name": "Stack overflow",
"adress": "ola"
}
}
}
}
}
When you generate the classes now you will see a different class structure. Is there a way how we can solve this with Jackson?