I have the following JSON, which each record has a city, but the same city can be in many records at once.
{
"data": [
{
"numero": "123",
"nombre": "jorge",
"ciudad": "Tokio"
},
{
"numero": "222",
"nombre": "juan",
"ciudad": "Tokio"
},
{
"numero": "777",
"nombre": "daniel",
"ciudad": "Tokio"
},
{
"numero": "333",
"nombre": "pedro",
"ciudad": "New york"
},
{
"numero": "444",
"nombre": "luis",
"ciudad": "New york"
},
{
"numero": "555",
"nombre": "andres",
"ciudad": "Buenos Aires"
}
]
}
I need to be able to group by city and only show 1 of them independent of the times it is repeated besides bring the number of elements found example:
result: (Tokyo, New york, Buenos Aires, 3)
/ * "3" is the number of cities found * /
Thank you very much for your attention, I will be attentive to your replies greetings.