I have a problem in parsing JSON received from server. In the model I have:
@JsonField(name = "skills")
private ArrayList<Skill> skills;
which has fields:
@JsonObject
public class Skill {
@JsonField
private int skillID;
@JsonField
private String name;
...
}
The ArrayList gets proper count of objects but all fields inside them are nulls.
JSON looks like:
{
"skills":[
{
"skill":{
"skillID":"1",
"name":"foo"
}
},
{
"skill":{
"skillID":"2",
"name":"bar"
}
}
]
}
The question is: How to extract the Skill objects into ArrayList without nesting additional class (Skill)?
Maybe there is a possibility to set the "skill" name on @JsonObject annotation?
Here I put easy solution for parsing: