Grouping JSON with java?

0

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?

    
asked by anonymous 26.04.2018 / 17:02

0 answers