I need to show a list of addresses in my app while keeping the same order as the response JSON. It looks something like this:
{
"addresses": {
"e5fdb5ba-7afb-11e8-bead-43321d1a8905": {
"contact": "Name1",
"zipCode": "06100"
},
"1495b580-7afc-11e8-bead-9f4049791561": {
"contact": "Name2",
"zipCode": "06100"
},
"e5fdb5ba-7afb-11e8-bead-43321d1a8905": {
"contact": "Name3",
"zipCode": "06100"
},
"1495b580-7afc-11e8-bead-9f4049791561": {
"contact": "Name4",
"zipCode": "06100"
}
}
}
But when I parse the response using
JSONSerialization.jsonObject(with: data, options: [])
The order of the addresses gets all mixed up. Is there a way to keep the exact same order as the JSON?