JSON Formatter
Format, validate, prettify, minify, and inspect JSON payloads with real-time error detection.
Runs in your browser. Nothing you add is uploaded.
What the JSON Formatter does
Unformatted JSON is hard to scan and harder to debug — a single missing comma in a 2,000-line API response can cost you an afternoon. This formatter parses your JSON with the browser's native engine, reports the exact line and column of any syntax error, and re-indents the result so nested structures become obvious at a glance. Nothing is uploaded: the parse happens in your tab, which matters when the payload contains tokens, customer records, or anything else you would not paste into a random website.
How to format JSON online
- Paste your raw JSON into the input box, or drop a .json file onto it.
- Choose your indentation — 2 spaces, 4 spaces, or tabs — to match your project's style guide.
- Click Format. Valid JSON is re-indented instantly; invalid JSON stops at the first error with a line number.
- Fix any reported syntax error and re-run. The most common causes are trailing commas and single quotes instead of double quotes.
- Use Minify to strip all whitespace when you need the smallest possible payload, then copy the result.
The JSON Formatter runs entirely in your browser — nothing you enter is uploaded, stored, or logged.
When to use it
Debugging API responses
When an endpoint returns a wall of unbroken text, formatting it is the fastest way to confirm the shape of the response — whether a field is nested one level deeper than you expected, or whether an array came back empty rather than absent.
Validating config files before deploy
A malformed package.json, tsconfig.json, or CI config will fail your build minutes after you push. Validating locally first turns a failed pipeline into a five-second check.
Shrinking payloads for production
Minified JSON removes every byte of indentation and newline. On large embedded configuration blobs this routinely cuts 20–30% of the transfer size with no change in meaning.
Good to know
- JSON requires double quotes around keys and string values — single quotes are a syntax error, even though JavaScript accepts them.
- Trailing commas after the final element of an array or object are invalid JSON, though most linters allow them in JavaScript source.
- JSON has no comment syntax. If your file has // or /* */ comments, it is JSON5 or JSONC, not JSON.
- NaN and Infinity are not valid JSON values; they must be encoded as strings or null.
Guides that use this tool
Frequently asked questions
Is my JSON stored?
What is the difference between formatting and validating JSON?
Why does my JSON fail with 'Unexpected token' errors?
Is there a size limit on the JSON I can format?
Does formatting change my data?
Can I use this for JSON Lines or NDJSON?
Related tools
JWT Decoder
Decode a JWT, see what each claim means, and verify its signature.
UUID Generator
Generate v4 and time-ordered v7 UUIDs in bulk, or inspect any UUID.
Regex Builder
Build a regular expression from blocks, with live matches.