Home / Code & Encoding Tools / JSON Formatter
JSON Formatter
Validate, pretty-print and minify JSON with exact error positions — no data leaves the browser.
Format, validate, minify
Paste JSON on the left and the tool parses it immediately. Valid input is pretty-printed with your chosen indentation; broken input gets a precise error message with the line and column where parsing stopped, which is far more useful than "unexpected token".
What it is good for
- Debugging an API response — paste the raw body and read the structure
- Checking a config file before committing (`package.json`, `tsconfig`, lock files)
- Minifying payloads to see how much whitespace costs
- Confirming shape — key count, nesting depth and byte size are summarised under the output
Error messages explained
- `Unexpected token }` — usually a trailing comma before `}` or a missing value.
- `Unexpected end of JSON input` — unbalanced brackets or a truncated paste.
- `Unexpected token '` — single quotes are not valid JSON; strings need double quotes.
- Bare keys (`{name:"x"}`) and comments (`// ...`) are not valid JSON either — JSON5 and JSONC allow them, JSON does not.
Notes and limits
- Parsing follows the strict JSON spec: no trailing commas, no comments, no `NaN`/`Infinity`, no single-quoted strings.
- Very large documents are handled in memory, so a browser tab is the practical limit.
- Your data never leaves the page — no upload, no server round-trip, no logging.
FAQ
Why is my JSON invalid?
The three usual culprits: a trailing comma, single-quoted strings, or comments. JSON is stricter than JavaScript object literals.
Can it handle very large files?
It parses in memory, so several megabytes are fine. For huge dumps use a command-line tool such as jq.
Is my data uploaded?
No. Parsing and formatting happen in your browser; nothing is sent to a server.