Sublime 4 Text Reindent JSON file

By default you can't reindent JSON file in Sublime. In order to do it you need to install additional package like Pretty JSON.

Install Pretty JSON

The easiest way to install new package in Sublime is by using Package manager. If you need more information about the package manager you can find it here:

Sublime Text 3 Tricks, Compare Files and Regex

  • Main menu
  • Preferences
  • Open Package Control
  • Add package
  • Search for Pretty JSON
  • Click to install it
  • Restart Sublime

Use Pretty JSON

This is the basic usage for Pretty JSON

  • Open JSON file
  • Reindent JSON file - CTRL+ALT+J

If you want to customise settings you can do it from:

  • Main menu
  • Preferences
  • Click Package Settings
  • Pretty JSON
  • Settings - Default

This are default setting which can be changed if you need:

{
    "use_entire_file_if_no_selection": true,
    "indent": 2,
    "sort_keys": false,
    "ensure_ascii": false,
    "line_separator": ",",
    "value_separator": ": ",
    "keep_arrays_single_line": false,
    "max_arrays_line_length": 120,
    "pretty_on_save": false,
    "validate_on_save": true
}

Selection_031

Related Article