How to use it
- Paste JSON into the input panel. Validation and formatting run as you type.
- Switch to Minify to strip all whitespace, or enable Sort keys to order keys alphabetically.
- If the document is invalid, the status bar shows the line and column where parsing failed.
Reading the error position
The single most useful thing a JSON tool can do is tell you where the problem is. Browsers report a character offset, which is useless when you are staring at a 4,000-line file, so this page converts that offset into a line and column.
One subtlety worth knowing: the reported position is where the parser gave up, not always where the mistake is. A missing closing brace is reported at the end of the document, because that is where the parser finally runs out of input. A missing comma is reported at the start of the next key, because that is the first token that could not follow the previous one. When the position looks innocent, look at the line above it.
What JSON does not allow
JSON is deliberately smaller than most people remember. The specification (RFC 8259) permits objects, arrays, strings, numbers, true, false and null — and nothing else. Four things that feel like they should work, but do not:
- Trailing commas.
[1, 2, 3,]is invalid. This is the most common single cause of parse failures, because most programming languages allow it. - Single quotes. Strings must use double quotes.
{'a': 1}is not JSON, it is a JavaScript object literal. - Unquoted keys.
{a: 1}is likewise JavaScript, not JSON. - Comments. There is no comment syntax at all. Tools that accept them (tsconfig.json, VS Code settings) are using JSONC, a superset.
Two more constraints catch people out less often but hurt more when they do. Numbers have no defined precision limit in the spec, but every practical parser uses a 64-bit float — so an ID above 2^53 will come back subtly wrong. And duplicate keys are undefined behaviour: parsers accept them and keep the last one, so data can disappear silently between systems.
Beautify or minify — when each matters
Formatting with indentation is for humans: reading a payload, diffing two versions, filing a bug. Minifying is for the wire, where every byte crosses a network. In practice the difference matters less than it used to, because gzip and Brotli compress repeated whitespace very efficiently — a minified payload is often only a few percent smaller after compression.
Where minifying does still pay off is anywhere the JSON is stored uncompressed and read often: a database column, a cache entry, a message queue payload. There, the saving is real and permanent.
Sorting keys
JSON objects have no defined key order, but the text does — and that is what your diff tool compares. Two payloads that are semantically identical will produce a noisy diff if the keys came out in a different order. Sorting both sides first turns that noise into an empty diff, which makes this one of the quickest ways to compare two API responses by hand.