JSON Formatter & Validator
Beautify, minify and validate JSON — all in your browser.
Working with JSON
JSON (JavaScript Object Notation) is the most common format for exchanging data between apps and APIs. This tool does three things: beautify re-indents JSON so it’s readable, minify strips whitespace so it’s as small as possible, and validate checks the syntax and points to the first error. Everything happens in your browser, so even sensitive payloads stay private. Pair it with our Base64 tool when APIs hand you encoded data.
What valid JSON allows
JSON is deliberately small: objects, arrays, strings, numbers, true, false and null. Most errors come from writing JavaScript rather than JSON.
| Not allowed in JSON | Why |
|---|---|
| Trailing comma after the last item | The grammar has no place for it |
| Single-quoted strings | Strings must use double quotes |
| Unquoted keys | Every key is a double-quoted string |
| Comments | No comment syntax exists — strip them before parsing |
| NaN, Infinity, undefined | Not JSON values; use null |
| Leading zeros or a bare leading dot | Numbers follow a strict grammar: 0.5, not .5 |
| Literal tabs or newlines inside strings | Must be escaped as \t and \n |
Reading an error message
Parsers report the character offset where the grammar broke, which is usually just after the real mistake. “Unexpected token } at position 214” typically means a trailing comma sat at position 213. Beautify first: with consistent indentation, a missing brace or bracket becomes visible as a block that never closes.
Beautify, minify, validate
- Beautify re-indents so structure is legible — what you want while debugging an API response.
- Minify strips all insignificant whitespace. On a large payload this often cuts 15–30% of bytes, though gzip narrows the gap considerably.
- Validate confirms the document parses at all. It cannot tell you whether the shape is right — that is what JSON Schema is for.
Two subtleties that bite in production
Large integers. JSON numbers have no size limit, but JavaScript parses them as 64-bit floats, so IDs beyond 2⁵³ silently lose precision. Transmit long identifiers as strings.
Key order and duplicates. Objects are unordered by specification, so never depend on the order of keys surviving a round trip. Duplicate keys are technically undefined behaviour; most parsers keep the last one.
For very large documents, prefer a streaming parser or newline-delimited JSON (one object per line) so consumers do not need the entire payload in memory at once.
Nothing leaves your browser
Parsing and formatting happen locally, so it is safe to paste internal payloads. No content is uploaded or logged.
JSON FAQ
What does a JSON formatter do?
Is my JSON uploaded anywhere?
Why does my JSON say unexpected token?
Are comments allowed in JSON?
Why do large ID numbers change value?
Does minifying JSON matter if I use gzip?
Recently used