Atom package for automatically formatting JSON documents.
This package does not by default provide any keyboard command shortcuts. There's no way to know what
keyboard shortcuts are even available on your machine. For example, on my machine I could map the
prettify
command to shift-cmd-j
. However if you have the popular atom-script
package
installed on your machine, then there would be a conflict because that package also wants to use
that same keyboard shortcut. However, all is not lost!
Atom itself already provides you with everything you need to
create your own custom keymaps. For example, the following keymap.cson
would add a
shortcut for the Prettify command:
'atom-text-editor':
'shift-cmd-j': 'pretty-json:prettify'
Map any of the following commands to your own keyboard shortcuts as described above.
pretty-json:prettify
pretty-json:minify
pretty-json:sort-and-prettify
pretty-json:jsonify-literal-and-prettify
pretty-json:jsonify-literal-and-sort-and-prettify
Select the text to format and then execute the Pretty JSON prettify
command. For JSON files,
format the entire file automatically without need to first select the text. Minify and sorting
commands are available too.
This plugin will post a notification to Atom if there is a parse error in the JSON. Disable warnings in this plugin's settings panel if you do not desire this feature.
To proactively avoid JSON errors, consider using a linter for JSON, such as the delightful linter-jsonlint.
MIT © lexicalunit, federomero et al