Paste minified JSON and instantly beautify it with proper indentation and syntax highlighting. Free JSON pretty printer — no signup, no data sent to servers.
Minified (hard to read):
{"user":{"id":101,"name":"Alice Johnson","email":"alice@example.com","roles":["admin","editor"],"active":true,"address":{"city":"New York","zip":"10001"}}}
Beautified (2-space indent):
{
"user": {
"id": 101,
"name": "Alice Johnson",
"email": "alice@example.com",
"roles": [
"admin",
"editor"
],
"active": true,
"address": {
"city": "New York",
"zip": "10001"
}
}
}
// 2-space indent (most common)
JSON.stringify(JSON.parse(minifiedJson), null, 2);
// 4-space indent
JSON.stringify(JSON.parse(minifiedJson), null, 4);
// Tab indent
JSON.stringify(JSON.parse(minifiedJson), null, '\t');
// Sort keys alphabetically while beautifying
const sorted = (k, v) => v instanceof Object && !Array.isArray(v)
? Object.keys(v).sort().reduce((acc, key) => ({ ...acc, [key]: v[key] }), {})
: v;
JSON.stringify(JSON.parse(minifiedJson), sorted, 2);
import json
minified = '{"name":"Alice","age":30,"city":"NYC"}'
# Beautify with 2-space indent
beautified = json.dumps(json.loads(minified), indent=2)
print(beautified)
# Sort keys + 4-space indent
beautified_sorted = json.dumps(json.loads(minified), indent=4, sort_keys=True)
# Beautify a file
with open('data.json') as f:
data = json.load(f)
with open('data-pretty.json', 'w') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
# Using Python (available on any system) cat data.json | python3 -m json.tool # Using jq (must be installed) cat data.json | jq . # With 4-space indent in jq cat data.json | jq --indent 4 . # Pretty print an API response curl https://api.example.com/users | python3 -m json.tool
| Style | Standard | Used By |
|---|---|---|
| 2 spaces | Most common | JavaScript, Node.js, most web APIs |
| 4 spaces | PEP 8 | Python, Java, C# ecosystems |
| Tabs | Adjustable | Teams that prefer tabs (width is editor-defined) |
JSON.stringify(data, null, 2) in JavaScript.Free, instant, private. Your JSON never leaves your browser.
Beautifying JSON adds whitespace and newlines to make it human-readable. This is the same as 'pretty-printing' and is essential for debugging minified API responses.
// Minified (hard to read)
{"user":{"id":1,"name":"Alice","roles":["admin","user"],"active":true}}
// Beautified with 2-space indent
{
"user": {
"id": 1,
"name": "Alice",
"roles": [
"admin",
"user"
],
"active": true
}
}
| Style | Common Usage | JavaScript |
|---|---|---|
| 2 spaces | Most popular for web/JS projects | JSON.stringify(obj, null, 2) |
| 4 spaces | Common in Python/Java projects | JSON.stringify(obj, null, 4) |
| Tab | Saves bytes, IDE-friendly | JSON.stringify(obj, null, "\t") |
| Compact | Smallest file size | JSON.stringify(obj) |
# Python
import json
print(json.dumps(data, indent=2))
# Node.js
console.log(JSON.stringify(data, null, 2));
# PHP
echo json_encode($data, JSON_PRETTY_PRINT);
# jq (command line)
cat file.json | jq .
Also useful: JSON Formatter | JSON Minifier | JSON Diff | Validate JSON