JSON Formatter
Paste JSON and reformat it with 2- or 4-space indentation, or minify it to a single line. Invalid input reports the syntax error with its line and column. Runs entirely in your browser.
About this tool
Paste JSON and reformat it with 2- or 4-space indentation, or minify it to a single line for transport. On a syntax error you get the message with the line and column, so a stray comma or missing brace takes seconds to find. Formatting parses and re-serializes the value, so the output is normalized rather than byte-identical to your input.
When to use it
Questions
Why did my numbers change?
JavaScript stores numbers as 64-bit floats, so integers above 2^53 - 1 lose precision and trailing zeros vanish (1.50 becomes 1.5). If you carry very large numeric IDs, store them as strings in your JSON.
Are trailing commas allowed?
No. Validation follows the JSON specification strictly — a trailing comma before a closing bracket is an error, as are single quotes, unquoted keys, comments and NaN. Lenient JSON5-style syntax is a different format.
What counts as valid JSON at the top level?
Any single value: an object or array, but also a bare string, number, boolean or null. The tool formatting 42 without complaint is correct behavior, not a bug.
What is the difference between pretty-printing and minifying?
Same JSON, opposite jobs. Pretty-printing adds indentation (2 or 4 spaces here) and line breaks so humans can read and diff the document; minifying strips all of it, which is what you want before sending a payload over the wire or embedding it in a config. Nothing about the data changes in either direction — parse the output and you get an identical value back.
Does formatting change my data?
Only whitespace. The tool parses your input and re-serializes the value, so keys keep their order and the structure is untouched — but the output is normalized rather than byte-identical. The two things that can visibly move are numbers (see the precision note above) and duplicate keys, where JSON.parse keeps the last occurrence and silently drops earlier ones.
How do I fix the syntax error it reports?
The error names the line and column — jump there first. The usual suspects: a trailing comma before a closing bracket, single quotes instead of double quotes, an unquoted key, a comment, or an unescaped quote inside a string. The tool validates and points at the problem; it does not silently repair input, because auto-repair has to guess, and a guess that parses is worse than an error you can see.
How large a file can it handle?
Formatting runs in your browser, so the practical limit is your machine's memory, not a server quota — multi-megabyte documents are fine and nothing is uploaded. Very large files make the text areas themselves sluggish, because the browser has to render what you paste; for a quick structural check of a huge file, a sample or the head of the file usually tells you what you need.