JSON Formatter & Validator

Paste any JSON below to pretty-print, minify, or validate it. Everything runs locally in your browser — your data never leaves your device.

What this tool does

This is a strict JSON formatter and validator built around your browser's native JSON.parse and JSON.stringify. It does three jobs: it pretty-prints minified JSON for readability, it minifies pretty JSON to save bytes, and it tells you exactly where in the input a syntax error occurs.

Common JSON errors and how to fix them

Trailing commas

JSON does not permit a trailing comma after the last item of an object or array. {"a": 1,} is invalid; {"a": 1} is correct.

Unquoted keys

Object keys must be double-quoted strings. { a: 1 } is invalid; { "a": 1 } is correct.

Single quotes

JSON only accepts double quotes for strings. Replace any 'value' with "value".

Comments

Standard JSON does not allow // or /* */ comments. If you need comments, look at JSON5 or JSONC — but most APIs reject them.

Unescaped characters in strings

Backslashes, double quotes, and control characters must be escaped: \\, \", \n, \t, etc.

JSON pretty-print options

Pretty-printing adds indentation and line breaks so a human can scan the structure. Two-space indentation is the most common style; four-space is sometimes used for deeply nested data. Both are valid JSON — only the whitespace differs.

Frequently asked questions

Is my JSON sent anywhere?

No. The page is static HTML; all parsing and formatting happens in your browser. There's no backend, no logging, and no analytics on your input.

Can I format very large JSON files?

Yes — the limit is your browser's memory. Files in the tens of megabytes work fine on most modern machines.

Why does the validator reject my config file?

If your config uses comments, trailing commas, or unquoted keys, it's likely JSON5 or JSONC, not strict JSON. Many tools (TypeScript's tsconfig, VS Code's settings.json) accept these extensions even though the file ends in .json.