Albert Prats
Albert Prats

Reputation: 796

SublimeText - sort json list alphabetically

I have a json formated list of countries and their ISO codes:

.
.
{"cod":"NC", "nombre":"Nueva Caledonia"},   
{"cod":"NE", "nombre":"Níger"}, 
{"cod":"NF", "nombre":"Islas Norkfolk"},    
{"cod":"NG", "nombre":"Nigeria"},   
{"cod":"NI", "nombre":"Nicaragua"}, 
{"cod":"NL", "nombre":"Países Bajos"},      
.
.

The list is sorted alphabetically but by the ISO code and not by the name. Is there any way to sort this list by name using sublime text or any other editor ?

Thanks

Upvotes: 3

Views: 6384

Answers (2)

Valor
Valor

Reputation: 353

Old question, but no accepted answer. https://jsoneditoronline.org has a function to do this.

Click the "sort" button and it will let you choose the property to sort on the "field" key.

JSON Editor Online - Sort elements

Upvotes: 2

Nuts
Nuts

Reputation: 31

If you split "cod" and "nombre" then you will be able to use SublimeText functional: Select text, Edit -> Sort Lines or press F5

Upvotes: 1

Related Questions