KKoumen Tools PRO

JSON formatter — format, minify, validate.

Format it, flatten it, or find the line that broke it. Nothing is uploaded — it all parses in this tab.

Waiting for input
Parsed
—
Keys—
Depth—
Input—

Formatting, minifying and actually finding the error

Every JSON error message says "unexpected token" and stops there. The useful information is which line, which column, and what was expected — and that is what this tool reports.

  1. Paste your JSON. Any size that fits in the browser. Nothing is uploaded, which matters if the payload contains tokens or customer data.
  2. Format or minify. Formatting indents the structure so it can be read; minifying removes all optional whitespace to reduce payload size. The result shows both the output size and the input size so the saving is visible.
  3. If it is invalid, read the error. The tool reports the line and column of the first structural error and describes what it found. A trailing comma after the last item in an object is the single most common cause, and it is legal in JavaScript but not in JSON.
  4. Check the structure summary. Key count and nesting depth are shown alongside. Depth is worth watching: deeply nested JSON is often a sign the data model needs flattening before it reaches a client.

When this comes up

A worked example: a tangled object, formatted

A payload like {"user":{"id":42,"name":"Ada","roles":["admin","editor"]},"active":true} is about 70 characters minified and roughly 150 with two-space indentation. Nothing about the data changed; only whitespace did, and whitespace is insignificant everywhere outside string values.

JSON formatter showing a sample payload indented with two spaces, with line and size counts
A sample payload formatted with two-space indentation. Minify reverses it without touching the data.

Formatting earns its keep when something is broken. A minified 4,000-character line gives you an error message and no context; the same payload indented shows at a glance that a bracket is missing three levels down. The usual culprit is a trailing comma before a closing brace, which every JavaScript engine accepts and JSON does not.

Minifying earns its keep on the wire. Stripping indentation typically removes 15–25% of the bytes of a pretty-printed payload, and gzip then removes most of what is left — a real saving, but rarely the reason a request feels slow.

Where JSON handling goes wrong

Questions

What is the most common JSON error?

A trailing comma after the last item in an object or array. JSON does not allow it, JavaScript does, and people write JSON in JavaScript habit. The second most common is single quotes instead of double quotes — JSON requires double quotes for both keys and string values.

Why does my JSON say "unexpected token" at the very end?

Usually because something earlier was never closed. A missing brace or bracket at the top of a long document reports as an error at the last character, because that is where the parser runs out of input. Check the opening brackets first.

Can JSON have comments?

No. Comments are not part of the JSON specification, and most parsers reject them. If you need them, the common workarounds are a _comment key or JSON5, but neither is valid JSON and both will break a strict parser somewhere downstream.

Does formatting change the data?

No. Whitespace between tokens is insignificant in JSON, so formatted and minified versions parse to identical values. Key order is preserved as written, though the JSON specification does not require parsers to preserve it — do not rely on ordering for logic.

More text tools

All 4 text tools →

All-Access — every tool, one payment

The formatter is free and stays free. All-Access removes the upgrade prompt and unlocks every tool on this site.