JSON Formatter & Validator

Beautify, minify and validate JSON with exact error positions and duplicate key detection — 100% in your browser.

Input JSON
Output

How to use the JSON formatter

  1. Paste raw JSON into the left pane, or click Sample to load a demonstration document.
  2. Choose an indentation option — 2 spaces, 4 spaces, or tab characters.
  3. Click Beautify to expand it, Minify to strip all whitespace, or Validate to check syntax without rewriting anything.
  4. Switch to Tree view for a collapsible, colour-coded view of nested objects and arrays. Click any row with children to collapse or expand it.
  5. Copy the result to your clipboard or download it as a .json file.

What this tool catches that most others miss

Exact error line and column

Standard JSON.parse() tells you the character offset of a failure, which is useless in a two-hundred-line file. This tool converts that offset into a line and column number and shows you the offending line itself, so you can jump straight to the problem.

Duplicate keys

{"status":"open","status":"closed"} is technically accepted by JSON parsers, which silently keep the last value. That silent behaviour is a well-known source of production bugs. This formatter scans each object independently and warns you about every repeated key, including nested ones.

Size reporting

Both panes report character count and byte size, so you can see exactly how much minification saved before and after.

Common JSON errors

ErrorWrongCorrect
Trailing comma{"a":1,}{"a":1}
Single quotes{'a':1}{"a":1}
Unquoted key{a:1}{"a":1}
Comments included{"a":1} // noteRemove comments
NaN / undefined{"a":NaN}{"a":null}

JSON is stricter than JavaScript object literals. If you copied something out of a JavaScript file, it will very likely contain trailing commas, unquoted keys or comments, all of which are invalid JSON.

Privacy. All parsing happens in your browser using JavaScript. Your JSON is never uploaded, never logged, and never sent anywhere. Open your browser's Network tab and watch it stay empty.

Frequently asked questions

Is there a size limit for the JSON I can format?

No artificial limit. Because processing happens on your own device rather than a server, the practical ceiling is your browser's available memory rather than a policy we impose.

Does beautifying change my data?

No. Formatting only alters whitespace, never values. Keys stay in their original order, numbers keep their precision representation, and no key gets silently dropped.

Why does my valid-looking JSON fail?

The four most frequent causes are trailing commas, single-quoted strings, unquoted keys, and JavaScript comments. The error panel reports the exact line and column so you can fix it immediately.

Can I use this for JSON Lines (NDJSON)?

Validate each line separately. NDJSON is a sequence of independent JSON documents separated by newlines, so the whole file is not a single valid JSON document.

Does the tree view preserve order?

Yes. The tree renders keys in the exact order they appear in your source document.