I tried looking for similar questions, and found this one Use Jackson to parse and unnamed array
However, I have a problem. My JSON has this unnamed array on a Nth level - very simplified version:
{
"section":{
"ID":"",
"code":{
"code":"",
"codeSystem":"",
"codeSystemName":""
},
"entry":[
{
"act":{
"classCode":"",
"entryRelationship":{
"name":""
}
},
"id":""
},
{
"act":{
"classCode":"",
"entryRelationship":{
"name":""
}
},
"id":""
}
]
}
}
There are even more levels higher than section, but this should represent the main problem. I have this "entry" key that can have multiple "act" and "id" (as properties of an unnamed object). I'm already using the ObjectMapper and @JsonProperty tools from the jackson library, and I want to keep things clean. A piece of code from the section (again, very simplified):
public class ComponentSection {
@JsonProperty("ID")
private String id;
@JsonProperty("code")
private Code code;
@JsonProperty("entry")
private SectionEntry entry;
}
Is there anything I can do to map this JSON?
Thanks!