JSON Formatter and Validator
Format messy JSON into readable, indented output — or minify it. Validation errors are pinpointed, and keys can be sorted alphabetically.
How to use it
- Paste your JSON — it validates as you type and tells you exactly where a problem is.
- Choose 2 spaces, 4 spaces or a tab, or pick Minify to strip every space.
- Sort keys makes two versions of the same object diff cleanly.
Takes JSON in any state — minified, malformed, inconsistently indented — and formats it into clean, readable output, or minifies it back down, validating as you type and pointing at exactly where a syntax problem is rather than just reporting 'invalid JSON'.
Formatting vs minifying
Formatting (beautifying) adds line breaks and indentation so nested structure is readable by a human — the version you want while debugging an API response or editing a config file by hand. Minifying strips every unnecessary space and line break, producing the smallest possible byte size — the version actually sent over the network in production, where whitespace only costs bandwidth with no benefit.
Common JSON syntax errors this catches
| Mistake | Why it fails |
|---|---|
| Single quotes around strings | JSON requires double quotes; single quotes are a JavaScript-only convenience |
| Trailing comma after the last item | JSON has no trailing commas, unlike modern JavaScript |
| // or /* */ comments | JSON has no comment syntax at all |
| Unquoted object keys | Keys must be double-quoted strings, not bare identifiers |
| A trailing or leading + on a number | JSON numbers don't allow a leading plus sign |
Sorting keys
Sorting keys alphabetically doesn't change what the JSON means, but it makes two versions of conceptually the same object comparable with a plain text diff — without sorting, two objects with identical content but keys in a different order look completely different line by line, which is a common source of noisy, meaningless diffs in version control.
Questions people ask
Is my JSON sent to a server?
No. Parsing and formatting use the browser's built-in JSON engine. Nothing leaves your machine — which matters, because pasted JSON often contains API keys and customer data.
Why does my JSON fail with single quotes?
JSON only allows double quotes around strings and keys, no trailing commas, and no comments. Those are JavaScript object rules, not JSON rules.
Last updated 17 August 2026