Sublime Text - JSON formatter shortcut Sublime Text - JSON formatter shortcut json json

Sublime Text - JSON formatter shortcut


I have come across this issue too. I tried to figure it out by install jsFormat as follows:

  1. Open Package Controll panel command+shift+p (mac), install package.
  2. Install jsFormat.
  3. Edit the shortcut for the jsformat:sublime text preferences, package settings, jsFormat

  4. Choose Key-Binding user, then edit

    [  {    "keys": [      "command+l"    ],    "command": "reindent"  },  {    "keys": [      "ctrl+shift+s"    ],    "command": "auto_save"  },   {    "keys": [      "ctrl+alt+f"    ],    "command": "js_format"  }]
  5. So next time when you try to format json code, just use ctrl+alt+f.

That's all.

Hope this will help you.

Cheers


Install this packages via CMD + SHIFT + P > Install package > Search for Pretty JSON and install.

enter image description here

And then turn ugly json via CMD + CTRL + J (OSX) CTRL + ALT + J (Windows/Linux) in pretty JSON!

Source is on GitHub. Credit


If you look at the source, the name of the sublime_plugin.TextCommand subclass is SublimeJsonReindentCommand. Per the conventions for command names, the resulting command is named sublime_json_reindent. Simply change your key binding to:

{ "keys": ["ctrl+shift+j", "ctrl+shift+j"], "command": "sublime_json_reindent" },

and you should be all set.