I have below json response which is returned as a group by id under remote object.
However to show on UI, I need to show the data after grouping it based on name. Can someone please suggest me how to group the data based on name on the data which was already grouped by backend API.
Can someone please assist here.
current response:
{
"remote": {
"12345": [
{
"id": "642232324873ab98",
"name": "Akon",
"account_id": "12345",
"account_name": "director"
}
],
"56780": [
{
"id": "6434343a1873ab98",
"name": "Jim",
"account_id": "56780",
"account_name": "director"
}
],
"others": [
{
"id": "6421ca1873ab980001bd465a",
"account_id": null
"account_name": "others"
}
]
}
expected output for remote object:
"remote": {
"director": [
{
"id": "6420691873ab98",
"name": "Akon",
"account_id": "12345",
"account_name": "director"
},
{
"id": "622121873ab98",
"name": "Jim",
"account_id": "56780",
"account_name": "director"
}
],
"others": [
{
"id": "6421ca1873ab980001bd465a",
"account_id": null,
"account_name": "others"
}
]
}
```