JSON Formatter & Validator

JSON Formatter & Validator

Beautify, minify and validate JSON. Your data never leaves your browser.


Validation uses your browser’s native JSON parser, so errors match what your code will see at runtime.

Format, minify, validate

Paste JSON above and choose an action. Format re-indents it at two spaces, four spaces or a tab for readability. Minify strips every optional byte of whitespace, which is what you want for anything going over the wire. Either action validates first, so an invalid document tells you exactly what is wrong instead of silently producing garbage.

Validation uses your browser native JSON parser rather than a bundled library. That is a deliberate choice: it means the errors you see here are byte-for-byte the errors your JavaScript will throw at runtime, so debugging in this tool transfers directly to debugging in your code.

The four errors that cause most invalid JSON

  1. Trailing commas. Legal in modern JavaScript, illegal in JSON. A comma after the final array element or object property will fail every parser.
  2. Single quotes. JSON requires double quotes on both keys and string values. Anything hand-written or copied out of a JavaScript file tends to trip on this.
  3. Unescaped characters. Literal newlines, tabs and unescaped double quotes inside a string value must be written as escape sequences.
  4. Comments. JSON has no comment syntax. Config formats that appear to allow them, such as JSONC or JSON5, are separate formats and will not parse as strict JSON.

Formatted or minified — which do you want?

The parsed data is identical, so the choice is purely about what happens to the text next. Pretty-printed JSON is for humans and for version control, where indentation produces line-by-line diffs you can actually review. Minified JSON is for machines: smaller payloads, faster transfer, and fewer tokens if you are feeding the data to a language model — you can check that saving with our token counter.

Frequently asked questions

Is my JSON sent to a server?

No. Parsing, formatting and validation all happen in your browser using the native JSON parser. Nothing is uploaded, which means you can safely paste API responses containing keys, tokens or customer data.

What does the error message mean?

Errors come straight from your browser JavaScript engine, so they are the same messages your code will produce at runtime. The most common causes are a trailing comma after the last item, single quotes instead of double quotes around keys or strings, and unescaped line breaks inside a string value.

Why is my valid-looking JSON rejected?

JSON is stricter than JavaScript object literals. Keys must be wrapped in double quotes, trailing commas are not allowed anywhere, comments are not permitted, and values like NaN, Infinity and undefined are not part of the specification.

When should I minify instead of format?

Minify for anything transmitted or stored: API payloads, config baked into a build, data pushed into an LLM prompt. Format for anything a human has to read or diff. Minifying removes only whitespace, so the parsed data is identical either way.

Does formatting change my data?

No. The tool parses your input into a JavaScript value and re-serialises it. Whitespace and key formatting change; the data does not. One thing to be aware of: duplicate keys are collapsed to the last occurrence, and key order follows JavaScript object rules rather than your original ordering.

More free developer tools

Dropout Developer hosts a growing set of free, no-signup utilities for self-taught developers: the Word Counter, the LLM Token Counter, the JSON Formatter & Validator, plus our AI Code Generator and AI Project Generator.

Chat Icon