I have a json like this:
"subject": {
"category": [
{
"name": "name1"
},
{
"name": "name2"
},
{
"name": "name3"
},
{
"name": "name4"
}
]
}
So it is an object containing a name array. What could be an equivalent Pojo for this?
Should I create a Subject object which has a string list called category?
I tried this:
public class Subject {
@JsonProperty(value = "category")
private List<String> name;
//getter setter ...
}
But I get nested exception: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token