A JSON formatter takes JSON that is minified, badly indented or simply hard to read and rewrites it with consistent indentation so you can actually follow its structure. This one also validates as it goes: if the document will not parse, it tells you the exact line and column where parsing stopped instead of just refusing to work.
How to format JSON
Formatting is instant and happens entirely in your browser — nothing is uploaded.
- Paste your JSON into the input pane, or type it directly.
- Choose an indentation style: two spaces, four spaces, or tabs.
- Optionally sort object keys alphabetically to make two documents easier to compare.
- Copy the formatted result, or switch to Minify to strip every unnecessary byte.
Reading the error messages
When JSON fails to parse, the position of the error is reported as a line and column. That position marks where the parser gave up, which is usually just after the real mistake — a trailing comma, a missing closing brace, or a value wrapped in single quotes rather than double quotes.
JSON is stricter than JavaScript object syntax. Keys must be double-quoted strings, trailing commas are not allowed, comments are not permitted, and NaN and Infinity are not valid values.
Formatting versus minifying
Formatted JSON is for humans: indentation and line breaks make nesting visible, which matters when you are reading an API response or a configuration file.
Minified JSON is for machines: every optional space and newline is removed, which reduces payload size over the network. Both represent exactly the same data, so you can move between them freely without changing meaning.
FAQ
Is my JSON sent to a server?
No. The formatter runs entirely in your browser using the built-in JSON parser. Your data never leaves your device, is never logged, and is never stored — which makes it safe to use with API responses that contain sensitive values.
Why does my JSON say it is invalid when it looks fine?
The most common causes are a trailing comma after the last item in an object or array, single quotes instead of double quotes, unquoted keys, or comments. All four are valid JavaScript but invalid JSON.
Does sorting keys change my data?
No. Object key order is not significant in JSON, so sorting keys produces an equivalent document. It is useful when you want to diff two API responses that return the same fields in a different order. Array order is never changed, because array order is significant.
Is there a size limit?
There is no fixed limit, but because formatting happens in your browser, very large documents (tens of megabytes) may be slow on low-powered devices. Files up to a few megabytes format effectively instantly.