How to reformat JSON in Notepad++
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
JSON (JavaScript Object Notation) is a light-weight data interchange format that's easy to read and write for humans, and easy to parse and generate for machines. However, sometimes when JSON data is generated, it may not be formatted, making it hard to read especially when you’re dealing with a large amount of data. Notepad++ is a popular text and source code editor for Windows which supports JSON formatting through plugins.
Steps to Reformat JSON in Notepad++
Step 1: Install Notepad++
If you don’t have Notepad++ installed on your computer, you first need to download and install it. You can download it from the official Notepad++ website.
Step 2: Install the JSON Viewer Plugin
To format JSON files easily in Notepad++, you'll need the JSON Viewer plugin which can be installed via the Plugin Manager. Here’s how you can install it:
- Open Notepad++.
- Click on the
Pluginsmenu and thenPlugins Admin. - In the plugins list, find
JSON Viewer. - Check the checkbox next to
JSON Viewerand click on theInstallbutton. - Restart Notepad++ to enable the plugin.
Step 3: Open Your JSON File
Load your JSON file into Notepad++ by using File > Open and selecting your file.
Step 4: Using JSON Viewer to Format JSON
With your JSON file opened:
- Click on
Pluginsmenu. - Hover over
JSON Viewerand then click onFormat JSON. - Your JSON should now be formatted in an easily readable form. If it doesn’t format, ensure your JSON is valid.
Additional Formatting Options
The JSON Viewer plugin also provides a few other useful tools for working with JSON:
- Compact JSON: This option removes unnecessary spaces and lines, making the JSON as small as possible.
- JSON Viewer: Shows a tree view of the JSON structure, which can be helpful for understanding the hierarchy and structure of the JSON.
Validation
Validating JSON is crucial before formatting because a malformed JSON will not format correctly. You can validate JSON using online tools like JSONLint or by using a script if you prefer offline validation.
Keyboard Shortcuts
To speed up your workflow in Notepad++, learning and using keyboard shortcuts can save time. Unfortunately, the JSON Viewer doesn't come with pre-set shortcut keys, but you can set them manually:
- Go to
Settings>Shortcut Mapper.... - Navigate to the
Plugin commandstab. - Find
Format JSON, and double-click to set a custom keyboard shortcut.
Table: Summary of JSON Viewer Features
| Feature | Description |
| Format JSON | Beautifies JSON, making it easier to read and review. |
| Compact JSON | Minimizes JSON to make it as concise as possible. |
| JSON Viewer | Provides a tree view of JSON, helping in understanding structure. |
| Validate JSON | Ensures the JSON is structurally and syntactically correct. |
Conclusion
Formatting JSON in Notepad++ is straightforward with the help of the JSON Viewer plugin. Not only does it help in making JSON readable, but it also comes with tools for minimizing and viewing the JSON structure, which can be immensely helpful for debugging and documentation. By utilizing this plugin, developers and data analysts can enhance their productivity significantly while handling JSON data.

