How to Format JSON Online — Beginner's Guide
You've just copied a JSON response from an API, and it looks like this:
{"users":[{"id":1,"name":"Alice","email":"alice@example.com","roles":["admin","editor"],"active":true},{"id":2,"name":"Bob","email":"bob@example.com","active":false}]}
Completely unreadable, right? This is called minified JSON — all whitespace removed to save bandwidth. To actually read it, debug it, or edit it, you need to format (or "beautify") it. Here's how.
What Is JSON Formatting?
JSON formatting (also called "pretty printing") takes minified JSON and adds proper indentation, line breaks, and spacing to make it human-readable. The data doesn't change at all — only the presentation.
Formatted JSON looks like this:
{
"users": [
{
"id": 1,
"name": "Alice",
"email": "alice@example.com",
"roles": ["admin", "editor"],
"active": true
},
{
"id": 2,
"name": "Bob",
"email": "bob@example.com",
"active": false
}
]
}
How to Format JSON in 3 Seconds
- Copy your minified JSON — Select and copy the compressed text (Ctrl+C / Cmd+C).
- Go to our JSON formatter — Open the DevTools JSON formatter. It's free, no signup required.
- Paste and format — Paste your JSON into the input box. The tool auto-formats it with proper indentation.
- Validate (optional) — Click "Validate" to check for errors. If the JSON is invalid, the tool will highlight the exact line and character.
When You'll Need to Format JSON
- API debugging — Checking API responses from REST endpoints. Minified responses are common in production.
- Configuration files — Reading or editing .json config files (package.json, tsconfig.json, eslint config).
- Data analysis — Inspecting exported JSON datasets from databases or analytics tools.
- Code review — Reviewing JSON changes in pull requests or commits.
- Learning — Understanding the structure of a JSON object when you're new to programming.
JSON Formatting vs JSON Validation
Formatting = making it readable (adding indentation). Validation = checking if it's correct JSON syntax. If your JSON has errors (missing comma, unquoted key, trailing comma), formatting will fail. The tool will show the error location so you can fix it. See our guide on common JSON errors and fixes.
Online Formatter vs CLI Tools
If you're working locally and have Node.js installed:
- Pretty print with Node.js:
node -e "console.log(JSON.stringify(JSON.parse(require('fs').readFileSync('file.json','utf8')),null,2))" - Python one-liner:
python -m json.tool file.json - jq (command-line JSON processor):
jq '.' file.json
But for quick formatting without opening a terminal, an online tool like DevTools JSON formatter is faster — paste, format, done.
Paste, format, validate. Instant results. No signup required.
Open JSON Formatter →