{
"transactionId": "11f8ecc05273e35a4eb2dc1a",
"type": "REQUEST_FOR_HH_INTERVIEW",
"answers": {
"selectProvinceDistrictCommuneVillage": {
"value": "01020706"
},
"positionOfOfficial": {
"value": "Province Officer"
},
"enterKhmerName": {
"value": "សុខ"
},
"selectSex": {
"value": "MALE"
},
"dob": {
"value": "1994-06-15T03:27:47.409Z"
},
"areYouMarried": {
"value": "YES"
},
"scanSpousesID": {
"value": "435465"
},
"enterSpousesKhmerName": {
"value": "នារី"
},
"selectSexSpouse": {
"value": "FEMALE"
},
"dobSpouse": {
"value": "1996-08-15T03:27:47.409"
},
"numberOfMales": {
"value": "4"
},
"numberOfFemales": {
"value": "5"
},
"selectReasonForRequesting": {
"value": [
"NATURAL_DISASTER"
]
}
}
}
So this is the JSON I need to parse into the dart model. The problem I am having with this structure is that map inside answers are all dynamic. Also, the number of the maps inside answers is not always the same. For example, the next JSON response can be.
{
"transactionId": "11f8ecc05273e35a4eb2dc1a",
"type": "REQUEST_FOR_HH_INTERVIEW",
"answers": {
"selectCode": {
"value": "01020706"
},
"selectRoomValue": {
"value": "1996-08-15T03:27:47.409"
},
"numberOfFamilyMembers": {
"value": "4"
},
"selectFoods": {
"value": [
"Piza",
"Burger"
]
}
}
}
which is different from the first response. I need to make a dart model that parses both responses.