danieltrost / json-sort

Atom.io Package to sort JSON
1 stars 0 forks source link

json-sort

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.

How to use json-sort

  1. Highlight the JSON you want to sort
  2. Press Control + Alt/Option + O or Command + Shift + P and search for JSON Sort

Example of json-sort

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"
    }
}