Prettify JSON
Format and indent JSON with customizable spacing. Makes minified JSON readable. 100% client-side.
Paste minified or messy JSON, pick your indent style, and get clean formatted output in one click — syntax errors get flagged with the exact character position so you can fix them fast. And everything runs in your browser. Nothing gets uploaded.
How It Works
The tool parses your input with JSON.parse() to validate the structure, then re-serializes it with JSON.stringify() using your chosen indent level. If the JSON is malformed, you get an error with the exact character position — not just a vague "invalid JSON" message. The entire process stays in JavaScript, in your browser tab.
Examples
Formatting an API Response
You hit a REST endpoint and the response comes back as one line.
{"users":[{"id":1,"name":"Alice","email":"[email protected]"},{"id":2,"name":"Bob","email":"[email protected]"}],"total":2}
{
"users": [
{
"id": 1,
"name": "Alice",
"email": "[email protected]"
},
{
"id": 2,
"name": "Bob",
"email": "[email protected]"
}
],
"total": 2
}
Debugging a Config File
Someone committed a package.json with weird formatting. Quick paste to see what changed.
{"name":"my-app","version":"2.1.0","scripts":{"build":"webpack --mode production","dev":"webpack serve"},"dependencies":{"react":"^18.2.0"}}
{
"name": "my-app",
"version": "2.1.0",
"scripts": {
"build": "webpack --mode production",
"dev": "webpack serve"
},
"dependencies": {
"react": "^18.2.0"
}
}
Reading Nested GeoJSON Data
GeoJSON coordinates are nearly impossible to parse visually when minified. Three levels of nested arrays — good luck reading that raw.
{"type":"Feature","geometry":{"type":"Point","coordinates":[-73.9857,40.7484]},"properties":{"name":"Empire State Building"}}
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-73.9857,
40.7484
]
},
"properties": {
"name": "Empire State Building"
}
}
Who Uses This
Reading API responses and debugging request payloads that come back as single-line blobs.
Formatting mock data files and checking component props that are stored as JSON.
Making sense of exported datasets before importing them into notebooks or spreadsheets.
Reviewing Terraform state files, CI/CD configs, and container manifests in JSON format.
Common Mistakes
JavaScript objects allow trailing commas, but JSON does not. If you copy an object straight from your JS code, remove that last comma before the closing brace or bracket.
JSON requires double quotes around keys and string values. Single quotes will throw a parse error every time. Python's json.dumps() handles this correctly, but hand-editing often introduces them.
Accidentally cutting off the end of a large response when copying from a terminal. The parser needs the complete structure — one missing closing bracket and the whole thing fails.
Standard JSON doesn't support comments. If you've got // this is a comment lines in there, strip them out first. JSON5 allows comments, but plain JSON does not.
Technical Details
- Processing: 100% client-side — nothing uploaded
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Input Size: Limited only by your browser's memory
- Indent Options: 2 spaces, 4 spaces, or tab characters
- Output: Copy to clipboard or download as .json file
Frequently Asked Questions
What does prettify JSON mean?
Prettifying JSON means adding whitespace, line breaks, and indentation so the data is easier to read. The actual data stays the same — only the formatting changes. Think of it like reformatting a paragraph with proper line spacing instead of cramming everything onto one line.
Is prettified JSON larger than minified JSON?
Yes, file size goes up because you're adding spaces and newlines. For a typical API response, prettified JSON is roughly 30-40% bigger. That's fine for reading and debugging — when you need it small for production, just minify it again.
Should I use 2 spaces or 4 spaces for JSON indentation?
Two spaces is the most common convention — it's what npm, VS Code defaults, and most style guides use. Four spaces works if your team prefers it or you're dealing with shallow nesting. Tabs are rare in JSON but some people swear by them. Pick one and stay consistent.
Can I prettify JSON with comments?
Standard JSON doesn't allow comments at all. If your file has // or /* */ comments, you're probably looking at JSON5 or JSONC (the format VS Code uses for settings). This tool parses strict JSON, so you'd need to strip comments first.
Does prettifying JSON change the data?
No. Not a single value, key, or data type changes. The formatter only adds or removes whitespace characters. If you minify the prettified output, you get back exactly what you started with, byte for byte.