This atom plugin allows you sort JSON in the text editor. Additionally, this will format the JSON to be indented with 4 spaces by default, however, it can be configured within the package settings to your desired indent.
Starting code:
{
"some": "string",
"another": true,
"here": 123
}
Output of json-sort:
{
"another": true,
"here": 123,
"some": "string"
}
Also works for nested JSON:
{
"test": {
"zzz": "asdf",
"aaa": "asdf"
},
"a": {
"x": "asdf",
"a": "asdf",
"v": "asdf"
}
}
Result of nested JSON:
{
"a": {
"a": "asdf",
"v": "asdf",
"x": "asdf"
},
"test": {
"aaa": "asdf",
"zzz": "asdf"
}
}