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.
Introduction
Notepad++ can format (pretty-print) JSON in one click using the built-in JSTool plugin or the JSON Viewer plugin. Once installed, you select your minified JSON, run the formatter, and the output becomes indented and readable. This guide covers every method, keyboard shortcuts, validation, and alternatives.
Method 1: JSTool Plugin (Recommended)
JSTool ships with recent Notepad++ installs. If it is already in your Plugins menu, skip to step 3.
Installation
- Open Notepad++.
- Go to Plugins > Plugins Admin.
- Search for JSTool.
- Check the box and click Install. Notepad++ will restart.
Formatting JSON
- Open or paste your JSON into a new tab.
- Go to Plugins > JSTool > JSFormat.
- Your JSON is now indented.
Keyboard shortcut: Ctrl+Alt+M formats the entire document by default.
Minifying JSON
To reverse the process and compress JSON onto a single line:
- Go to Plugins > JSTool > JSMin.
- Or press
Ctrl+Alt+N.
Example
Before (minified):
After Ctrl+Alt+M (formatted):
Method 2: JSON Viewer Plugin
JSON Viewer provides formatting plus a tree view that lets you visually browse the structure.
Installation
- Plugins > Plugins Admin.
- Search for JSON Viewer.
- Install and restart.
Formatting
- Open your JSON file.
- Go to Plugins > JSON Viewer > Format JSON.
Tree View
Select Plugins > JSON Viewer > Show JSON Viewer to open a dockable panel with a collapsible tree. This is useful for navigating deeply nested objects without scrolling through thousands of lines.
Method 3: Python Script Plugin (Advanced)
If you prefer full control or want to customize indentation, you can use the Python Script plugin.
- Install Python Script from Plugins Admin.
- Go to Plugins > Python Script > New Script. Name it
FormatJSON.py. - Paste:
- Run with Plugins > Python Script > Scripts > FormatJSON.
This approach lets you change the indent size, sort keys, or strip Unicode escapes.
Setting Custom Keyboard Shortcuts
Neither JSON Viewer nor Python Script has a default shortcut. To assign one:
- Go to Settings > Shortcut Mapper.
- Click the Plugin commands tab.
- Find the command (e.g., "Format JSON" or "JSFormat").
- Double-click it and set your preferred key combination.
A common choice is Ctrl+Shift+J for format and Ctrl+Shift+M for minify.
Validating JSON Before Formatting
Formatting will fail silently or throw errors if your JSON is malformed. Common problems:
| Problem | Example | Fix |
| Trailing comma | {"a": 1,} | Remove the comma after the last value |
| Single quotes | {'a': 1} | Replace with double quotes |
| Unquoted keys | {a: 1} | Wrap keys in double quotes |
| Comments | // note or /* */ | Remove comments (JSON does not allow them) |
| Missing colon | {"a" 1} | Add : between key and value |
To validate without formatting, use Plugins > JSON Viewer > Check JSON syntax or paste into an online tool like JSONLint.
Comparison: Formatting Methods
| Feature | JSTool | JSON Viewer | Python Script |
| Pretty-print | Yes | Yes | Yes |
| Minify | Yes | Yes (Compact JSON) | Manual |
| Tree view | No | Yes | No |
| Custom indent | No | No | Yes |
| Sort keys | No | No | Yes |
| Default shortcut | Ctrl+Alt+M | None | None |
| Handles large files (100MB+) | Good | Slower | Depends |
Alternatives Outside Notepad++
If you work with JSON frequently, these command-line and editor alternatives can be faster:
Command line (Python, already installed on most systems):
Command line (jq):
VS Code: Open any .json file and press Shift+Alt+F (Windows) or Shift+Option+F (macOS) to format.
Browser DevTools: Paste JSON into the console with JSON.stringify(JSON.parse(text), null, 2).
Common Pitfalls
- BOM characters. Files saved as UTF-8 with BOM can cause the first character to be invisible but invalid. Switch encoding to UTF-8 (without BOM) in Encoding > Convert to UTF-8.
- Large files freeze Notepad++. For files over 100 MB, use
jqon the command line instead. - Encoding issues with special characters. If accented characters break after formatting, ensure your file encoding matches the JSON content (UTF-8 is almost always correct).
- Plugin not appearing after install. Check that the plugin architecture (32-bit vs 64-bit) matches your Notepad++ version.
- Formatting only part of a file. Select just the JSON portion before running the formatter. If no text is selected, the plugin formats the entire document.
Summary
- Install the JSTool plugin for the fastest one-shortcut formatting (
Ctrl+Alt+Mto format,Ctrl+Alt+Nto minify). - Use JSON Viewer if you need a tree view to navigate complex structures.
- Use the Python Script plugin for custom indent sizes or key sorting.
- Always validate JSON before formatting to avoid silent failures.
- For files over 100 MB, use command-line tools like
jqorpython -m json.tool. - Set custom keyboard shortcuts through Settings > Shortcut Mapper > Plugin commands.

