JSON Formatter and Validator
Format, indent and validate JSON instantly, or minify it to the smallest size. Precise error messages with line numbers, all processed in your browser.
Runs entirely in your browser — nothing is uploaded
Format, minify, validate
Format re-indents your JSON so the structure is visible, which is what you want when reading an API response or reviewing a config file. Minify strips every space and line break outside of strings, producing the smallest valid representation for shipping over the wire.
Both operations validate as a side effect: if the text parses, it is valid JSON, and if it does not, you get the reason and the exact position instead of a result.
The five errors that cause almost every failure
A trailing comma
{"a": 1, "b": 2,} is valid JavaScript and invalid JSON. This is the most common single cause, because most editors and languages tolerate it everywhere else.
Single quotes
JSON requires double quotes around both keys and string values. {'name': 'Ana'} is a JavaScript object literal, not JSON. Keys must be quoted too — bare {name: "Ana"} also fails.
An unescaped character inside a string
Literal line breaks, tabs and unescaped backslashes cannot appear inside a JSON string. A Windows file path is the usual culprit: it needs to be written as C:\\Users\\name, with each backslash doubled.
Comments
JSON has no comment syntax. Neither // nor /* */ is allowed, which regularly surprises people editing a config file by hand. Some tools accept a superset called JSON5 or JSONC; standard parsers, including this one, do not.
A stray wrapper
Copying from a browser console or a log often brings along a prefix such as data: or a surrounding pair of quotes. If the error points at position 0 or 1, look at the very start of the text.
Reading the error position
The error reports a line and column derived from the character offset the parser stopped at. That position marks where parsing became impossible, which is usually one token after the actual mistake. A missing comma on line 12 typically reports as an unexpected token on line 13 — so when the reported line looks fine, check the line above it.
What formatting changes, and what it does not
Values are never altered, and key order is preserved exactly as written. Two things do change, both required by the specification. Duplicate keys collapse to the last occurrence, so {"a": 1, "a": 2} becomes {"a": 2}. And numbers are parsed as 64-bit floats, so an integer beyond about 9 quadrillion loses precision — if your data carries large IDs, they should be transmitted as strings.
Is it safe to paste real data here?
Yes. Parsing and formatting use the JSON engine already built into your browser, running on your own machine. Nothing is uploaded, stored or logged, and the page continues to work with your network disconnected.
That is worth caring about, because the JSON people most need to format is exactly the JSON they should not paste into an unknown server: API responses containing tokens, exported customer records, and internal configuration.
Frequently asked questions
Is it safe to paste production data here?
Yes. Parsing and formatting run entirely in your browser using the native JSON engine, so nothing is transmitted or stored. That matters for JSON containing API keys, customer records or internal identifiers.
Why does my JSON fail to validate?
The three most common causes are a trailing comma after the last item, single quotes instead of double quotes around keys or strings, and an unescaped line break inside a string. The error message points to the exact line and column so you can jump straight to it.
Should I use 2 or 4 spaces for indentation?
Two spaces is the dominant convention for JSON and keeps deeply nested structures readable without horizontal scrolling. Four spaces is easier to scan in shallow files. Both are valid — pick whichever your team already uses.
What does minifying actually save?
It strips every space and line break outside of strings, which typically cuts 15 to 30 percent off the file size. Use it for API responses and config shipped to browsers, and keep the formatted version in version control so diffs stay readable.
Does formatting change my data?
No values change. Key order is preserved and duplicate keys collapse to the last one, exactly as the JSON specification requires. Very large numbers may lose precision, because JavaScript stores all numbers as 64-bit floats.