Data
JSON Formatter & Validator
Paste JSON and get it pretty-printed, minified or validated. When it breaks, you get the parser's own message so you can find the stray comma fast.
Formatted JSON will appear here.
How to use it
- Paste or type JSON into the box above.
- Press Format to indent it, or Minify to strip every space.
- Choose 2 spaces, 4 spaces or a tab for indentation.
- If the JSON is broken, the exact parser message appears underneath.
JSON is stricter than a JavaScript object literal
Three things that are legal in JavaScript are illegal in JSON: trailing commas, single-quoted strings, and comments. A JSON parser stops at the first character it cannot accept, so the reported position usually points at the comma after the last property rather than at the property itself. Fixing that single character frequently repairs the whole document.
Numbers are not always safe
JSON has no integer type. Every number is parsed as an IEEE-754 double, so anything above 2^53 loses precision: the identifier 1234567890123456789 comes back as 1234567890123456800. If a value is an identifier rather than a quantity — a user ID, an order number, a snowflake — store it as a string from the start. Once it has round-tripped through a parser, the original digits cannot be recovered.
When the file is tens of megabytes
Browsers format a large document by parsing the whole thing into memory and serialising it again, so the practical ceiling is roughly two to four times the file size in RAM. A 40 MB log file will usually stall a tab. For anything that size, split it into records first — most JSON logs are newline-delimited — and format one record at a time.
If the file must be inspected whole, a streaming tool such as jq is the right instrument: jq . big.json formats it without loading the entire structure at once, and jq -c minifies it line by line.
Frequently asked questions
Does my JSON get uploaded anywhere?
No. Your browser's own JSON parser does the work, so the text never leaves the page.
Why does valid-looking JSON report “Unexpected token”?
Trailing commas, single quotes and comments are not legal JSON. The message points at the first character the parser could not accept.
How large a file can it handle?
Until your browser runs out of memory — usually several megabytes. Large inputs are slower to reformat but still stay local.
Can I format JSON without an internet connection?
Yes. Once the page has loaded, everything runs from memory; you can go offline and keep formatting.
Does it accept JSON5, comments or trailing commas?
No — strict JSON only. Comments and trailing commas are rejected, which is what you want when checking whether a file will parse in production.