Pretty-Formatting JSON in Sublime Text
Readable formatting makes JSON much easier to inspect during development and troubleshooting. Instead of copying data into an external website, Sublime Text can format JSON directly through a plug-in.
Version context: This workflow was written for Sublime Text 3 and the Pretty JSON package available at the time. Package names, installation steps, and shortcuts may differ in current Sublime Text versions.
Install the Pretty JSON Package
- Open Sublime Text.
- Open the Command Palette:
- macOS:
Command + Shift + P - Windows:
Ctrl + Shift + P
- macOS:
- Choose Install Package.
- Search for Pretty JSON.
- Install the package.
Format JSON
Select the JSON content and use the package shortcut:
- macOS:
Command + Control + J - Windows:
Ctrl + Alt + J
The selected JSON is reformatted in place.
Why Local Formatting Helps
Formatting locally is faster and can also be preferable when payloads contain internal or sensitive data that should not be pasted into an external web service.
Takeaway
A lightweight editor plug-in can make routine JSON inspection faster while keeping development data inside the local toolchain.