How do you group the json below according to the id?
I have the following json:
{
"origem": [
{
"id": 154826,
"nm": "",
"tp": "",
"am": "",
"sg": "SAO",
"sq": 925
},
{
"id": 2289,
"nm": "",
"tp": "",
"am": "",
"sg": "RIO",
"sq": 925
},
{
"id": 154826,
"nm": "",
"tp": "",
"am": "",
"sg": "SAO",
"sq": 925
}
]
}
After grouping it would look like this:
{
"origem": [
{
"id": 154826,
"nm": "",
"tp": "",
"am": "",
"sg": "SAO",
"sq": 925
},
{
"id": 2289,
"nm": "",
"tp": "",
"am": "",
"sg": "RIO",
"sq": 925
}
]
}
In case it would be more remove the repeated items. Does anyone know how to do this?