JSON Formatter
Pretty-print, validate and minify JSON instantly — with clear error messages. Free, fast and private: your data never leaves your device.
How to format JSON online
- Paste your JSON into the box above — as you type, the tool validates it live and shows a green tick or a precise error.
- Pick your indentation (2 spaces, 4 spaces, or tab) and click Format / Beautify to pretty-print the document.
- Use Minify to strip every byte of whitespace, Copy to grab the result, or Clear to start fresh.
Why use a JSON formatter?
Minified or hand-edited JSON is hard to read and easy to break. A formatter re-indents it consistently so the structure of objects and arrays is obvious at a glance, while the validator catches missing commas, unquoted keys, mismatched brackets, and stray trailing characters before they cause bugs in your API responses, config files, or CI pipeline. Because everything runs locally with the browser's native JSON engine, even payloads that contain access tokens, customer records, or other sensitive data stay on your machine — nothing is uploaded, logged, or stored.
Format vs. minify: which do you need?
Both buttons read and re-serialize the same parsed data, so they never change your values — only the whitespace between them. Use this as a quick guide:
| Goal | Action | Result |
|---|---|---|
| Read, review or debug | Format / Beautify | Indented, line-broken, diff-friendly |
| Ship over the wire or embed | Minify | Smallest valid payload, no whitespace |
| Confirm it parses | Just paste | Live validation as you type |
Common use cases
- Debugging API responses — paste a raw payload from your network tab or a
curlcall and beautify it to trace nested fields. - Cleaning up config files — tidy
package.json,tsconfig.json, or any settings file with consistent indentation. - Catching syntax errors — locate the missing comma or unbalanced brace that's making a parser throw.
- Shrinking payloads — minify before embedding JSON in a data attribute, query string, or another file.
- Comparing two documents — format both with the same indentation so a line-by-line diff actually lines up.
Tips & gotchas
This validator follows the strict JSON standard (RFC 8259), the same one browsers, most servers, and language standard libraries enforce — so what passes here will parse almost anywhere. A few things commonly trip people up: keys and string values must use double quotes, not single quotes; trailing commas after the last item are not allowed; comments (// or /* */) are invalid JSON even though many editors tolerate them; and the top level must be a single object, array, string, number, boolean, or null — not several values in a row. When a parse fails, the status line reports the exact character position from the native engine, so work outward from that spot to find the real cause.