When there are duplicate 'id' keys among the objects in the array, how can you remove the object with the duplicated 'id'?
I attempted to use filter, map, and set methods, but none of them were successful. Since the array is not one-dimensional, I am unsure of the correct approach.
Original:
"category": {
"key": 1,
"order": 1,
"list": [
{
"id": "12345",
...
},
{
"id": "12345",
...
},
{
"id": "67890",
...
},
]
}
Desired Output:
"category": {
"key": 1,
"order": 1,
"list": [
{
"id": "12345",
...
},
{
"id": "67890",
...
},
]
}