JSON Formatter

Paste JSON to pretty-print it with your choice of indentation, or minify it back down. Invalid JSON gets an error naming the line and column and showing the surrounding text, which is usually enough to spot the trailing comma or unquoted key. Runs locally, so it is safe for JSON you should not upload.

Why valid-looking JSON fails

Almost every rejection comes down to JSON being stricter than a JavaScript object literal. Trailing commas after the last element, single quotes instead of double, unquoted keys and // comments are all fine in JavaScript and all illegal in JSON. So are NaN, Infinity and undefined.

The big-number caveat

JSON numbers have no size limit, but JavaScript parses them as 64-bit floats. Any integer above 2^53 loses precision silently - a 19-digit database ID will come back subtly wrong. If you are handling such IDs, transport them as strings.

Nothing is uploaded

Parsing and formatting run in your browser, so it is safe to paste API responses, configuration files and anything containing tokens. There is no request to inspect and no server log to worry about.

Frequently asked questions

Why is my JSON invalid?

Most often a trailing comma after the last item, single quotes instead of double, unquoted keys, or a stray comment. All four are legal in JavaScript object literals and none are legal in JSON, which is what trips people up.

Is my data sent to a server?

No. Parsing and formatting happen in your browser with no network request, so you can safely paste API responses or configuration that contains credentials.

Related tools

Steuervergleich Kanton Zürich — Gemeindesteuern vergleichen (Deutsch)