I have a flat json array which look like this :
[
{
"homeID": "ID1",
"homeName": "David",
"childID": "ID1",
"childName": "AAAA"
},
{
"homeID": "ID1",
"homeName": "David",
"childID": "ID2",
"childName": "AAAAA"
},
{
"homeID": "ID2",
"homeName": "CASEY",
"childID": "ID1",
"childName": "AAAA"
},
{
"homeID": "ID2",
"homeName": "CASEY",
"childID": "ID2",
"childName": "AAAAA"
}
]
Now what i need to do is to decode this JSONARRAY to a List of list<HOME>
and in this list of HOMES I have a list list<CHILD>
my Bean class :
public class Home{
private String homeName;
private list<CHILD>;
public Home(){}
}
public class Child{
private String childName;
public Child(){}
}
So what's the best practice to do this mapping with Jackson
JSON lib and java 8
?