I have some contact data that gets returned as an array, like this:
[
{
"contacts": [
{
"contactEntries": [
{
"entryId": "tel0",
"label": "extension",
"type": "tel",
"uri": "1001"
},
{
"entryId": "tel1",
"label": "work",
"type": "tel"
},
{
"entryId": "tel2",
"label": "cell",
"type": "tel"
},
{
"entryId": "tel3",
"label": "home",
"type": "tel"
}
],
"contactId": "a9a8091b-2cc7-4a4b-b31f-db9a488ad0b5",
"displayName": "Acrobits Support",
"fname": "Acrobits",
"lname": "Support"
},
{
"contactEntries": [
{
"entryId": "tel0",
"label": "extension",
"type": "tel",
"uri": "115"
},
{
"entryId": "tel1",
"label": "work",
"type": "tel"
},
{
"entryId": "tel2",
"label": "cell",
"type": "tel"
},
{
"entryId": "tel3",
"label": "home",
"type": "tel"
}
],
"contactId": "25353f86-64c1-4fea-9601-d369a0623319",
"displayName": "Fancy Lawn",
"fname": "Fancy",
"lname": "Lawn"
}
]
}
]
The app I’m responding to is expecting just an object not an array, like this:
{
"contacts": [
{
"contactEntries": [
{
"entryId": "tel0",
"label": "extension",
"type": "tel",
"uri": "1001"
},
{
"entryId": "tel1",
"label": "work",
"type": "tel"
},
{
"entryId": "tel2",
"label": "cell",
"type": "tel"
},
{
"entryId": "tel3",
"label": "home",
"type": "tel"
}
],
"contactId": "a9a8091b-2cc7-4a4b-b31f-db9a488ad0b5",
"displayName": "Acrobits Support",
"fname": "Acrobits",
"lname": "Support"
},
{
"contactEntries": [
{
"entryId": "tel0",
"label": "extension",
"type": "tel",
"uri": "115"
},
{
"entryId": "tel1",
"label": "work",
"type": "tel"
},
{
"entryId": "tel2",
"label": "cell",
"type": "tel"
},
{
"entryId": "tel3",
"label": "home",
"type": "tel"
}
],
"contactId": "25353f86-64c1-4fea-9601-d369a0623319",
"displayName": "Fancy Lawn",
"fname": "Fancy",
"lname": "Lawn"
}
]
}
How can I accomplish this? It seems simple in my head but I can’t seem to figure it out