DEV

JSON Formatter & Validator

Paste JSON on the left. Format it for readability or minify it for transport — invalid JSON gets a plain-English error instead of a blank output.

INPUT
OUTPUT

          

How it works

The formatter uses JavaScript's built-in JSON.parse and JSON.stringify — the same parser your browser uses internally, so if it says your JSON is invalid, a real JSON consumer would reject it too.

Common reasons JSON fails to parse

ProblemExample
Trailing comma{"a": 1, "b": 2,}
Single quotes{'a': 1} instead of {"a": 1}
Unquoted key{a: 1} instead of {"a": 1}
CommentsJSON has no comment syntax — // like this will fail

Frequently asked

Why does it say my JSON is invalid when it looks fine?

The most common causes are a trailing comma after the last item, single quotes instead of double quotes, or an unquoted key. The error message names the position where parsing stopped, which is usually right before the actual problem.

What's the difference between formatting and minifying?

Formatting adds indentation and line breaks so JSON is easy to read. Minifying removes all unnecessary whitespace to produce the smallest possible output, which is what you'd send over a network.

Is my JSON sent anywhere?

No. Parsing, formatting and minifying all happen in your browser with JavaScript's built-in JSON support — nothing is uploaded to a server.