JSON Beautifier Guide 2026: Format and Pretty Print JSON
Complete guide to JSON beautifiers. Learn how to format, minify, and pretty print JSON using online tools, command line, and code.
Big JSON Team
• Technical WriterExpert in JSON data manipulation, API development, and web technologies. Passionate about creating tools that make developers' lives easier.
What is a JSON Beautifier?
A JSON beautifier (also called formatter or pretty printer) transforms compact JSON into readable, indented format.
Before (Minified)
{"users":[{"name":"Alice","age":30},{"name":"Bob","age":25}]}
After (Beautified)
{
"users": [
{
"name": "Alice",
"age": 30
},
{
"name": "Bob",
"age": 25
}
]
}
Why Beautify JSON?
Online Beautifiers
Big JSON Viewer
Handles files up to 100MB+
JSONLint
Classic validator with formatting.
Command Line Tools
jq
# Install
brew install jq # Mac
apt install jq # Linux
# Beautify
jq '.' input.json > output.json
# Custom indent
jq --indent 4 '.' input.json
# Sort keys
jq -S '.' input.json
Python
# Built-in module
python -m json.tool input.json
# Custom indent
python -c "import json; print(json.dumps(json.load(open('input.json')), indent=4))"
Code Editor Formatting
VS Code
- Shortcut: Shift+Alt+F (Windows) or Shift+Option+F (Mac)
- Command: Ctrl+Shift+P → "Format Document"
- Auto-format on save: Enable in settings
Programmatic Beautification
JavaScript
const ugly = '{"name":"John","age":30}';
const pretty = JSON.stringify(JSON.parse(ugly), null, 2);
console.log(pretty);
// Custom indent (4 spaces)
JSON.stringify(obj, null, 4);
// Tabs instead of spaces
JSON.stringify(obj, null, '\t');
Python
import json
ugly = '{"name":"John","age":30}'
data = json.loads(ugly)
pretty = json.dumps(data, indent=2)
print(pretty)
# Sort keys
json.dumps(data, indent=2, sort_keys=True)
JSON Minification
The opposite - remove whitespace to reduce file size:
// JavaScript
const minified = JSON.stringify(obj);
// jq
jq -c '.' input.json
Tool Comparison
| Tool | Speed | Large Files | Validation | Free |
|------|-------|-------------|------------|------|
| Big JSON Viewer | Fast | ✅ | ✅ | ✅ |
| jq | Very Fast | ✅ | ❌ | ✅ |
| VS Code | Fast | Medium | ✅ | ✅ |
| Python | Medium | Medium | ❌ | ✅ |
Best Practices
Formatting Options
Indentation Styles
- 2 spaces: Standard for web development
- 4 spaces: Common in Python projects
- Tabs: Less common, larger file size
Key Sorting
Alphabetically sorted keys make diffs clearer:
{
"age": 30,
"email": "alice@example.com",
"name": "Alice"
}
Conclusion
For quick formatting, use Big JSON Viewer or jq. For regular editing, configure your editor to auto-format on save!
Related Articles
How to Format JSON: Pretty Print and Beautify Guide 2026
Learn how to format and beautify JSON using command-line tools, code editors, online formatters, and programming languages. Complete guide with examples.
Best JSON Online Tools 2026: Viewers, Validators, and Formatters
Comprehensive guide to the best JSON online tools. Compare viewers, validators, formatters, and converters for working with JSON data.
How to Open JSON Files: Complete Guide for All Platforms
Learn how to open and view JSON files on Windows, Mac, and Linux. Covers text editors, online tools, and specialized JSON viewers.