JSON Formatter & Validator
Paste messy JSON, get it back readable and syntax-highlighted — or minified for shipping. Invalid input is pinpointed to the exact line and column. Everything runs in this tab: no upload, no request, no server ever sees your data.
- Instant · client-side
- Precise error locations
- Zero data upload
Formatted output appears here.
Waiting for input.
Six Errors That Break Most JSON
Nearly every parse failure comes from one of these. The messages shown are what V8 — the engine behind Chrome, Edge and Node.js — actually reports, so you can match them against your own console.
Trailing comma
Expected double-quoted property name in JSON at position 7
JavaScript object literals tolerate a comma after the last entry. JSON does not — the parser expects another key and hits } instead. This is the single most common cause, and it usually appears after deleting a line.
{
"a": 1,
"b": 2,
}
{
"a": 1,
"b": 2
}
Single quotes
Expected property name or '}' in JSON at position 1
JSON strings must use double quotes — for keys and values alike. Single quotes are valid JavaScript but not valid JSON, which is why pasting a JS object straight from your editor rarely parses.
{'city': 'Leeds'}
{"city": "Leeds"}
Unquoted keys
Expected property name or '}' in JSON at position 1
Every key must be a quoted string. Bare identifiers work in JavaScript and in JSON5, but plain JSON has no such shorthand — a frequent trap when copying config out of a .js file.
{port: 8080}
{"port": 8080}
Comments
Expected property name or '}' in JSON at position 4
The JSON spec has no comment syntax at all — neither // nor /* */. Editors like VS Code accept them in settings.json only because those files are JSONC, a separate dialect.
{
// the port
"port": 8080
}
{
"_comment": "the port",
"port": 8080
}
NaN, Infinity or undefined
Unexpected token 'N', "{"v":NaN}" is not valid JSON
JSON numbers are finite decimals only. These three slip in when a server serialises a failed calculation by hand — note that JSON.stringify itself converts them to null, or drops the key entirely for undefined.
{"score": NaN,
"cap": Infinity}
{"score": null,
"cap": null}
Raw line breaks in strings
Bad control character in string literal in JSON at position 10
A literal newline or tab inside quotes is illegal; it must be escaped as \n or \t. This shows up when log output or a textarea value is pasted into a JSON string without escaping.
{"note": "line
break"}
{"note": "line\nbreak"}
JSON vs JSON5 vs JSONC
If a file with comments parses in one tool but not another, it is almost certainly not plain JSON. This validator targets strict JSON — the format APIs actually exchange.
| Feature | JSON | JSON5 | JSONC |
|---|---|---|---|
| Comments | No | Yes — // and /* */ |
Yes — // and /* */ |
| Trailing commas | No | Yes | Yes, but discouraged |
| Unquoted keys | No | Yes | No |
| Single-quoted strings | No | Yes | No |
Hex & NaN / Infinity |
No | Yes | No |
| Where you meet it | APIs, storage, config everywhere | Hand-edited config — Babel, Chromium | VS Code settings.json, tsconfig.json |
Keyboard Reference
Frequently Asked Questions
Does formatting change my JSON data?
Not the data, no. Formatting only rewrites whitespace, so the parsed result is identical — {"a":1} and a pretty-printed version deserialise to exactly the same object.
Two byte-level details are worth knowing. Object keys are re-emitted in JavaScript's property order, which means integer-like keys are sorted numerically first: {"2":"b","1":"a"} comes back as {"1":"a","2":"b"}. And duplicate keys collapse to the last one, since the first was already overwritten during parsing. Both are properties of JSON parsing itself, not of this tool.
Why does my JSON pass validation but still break my app?
Because valid syntax says nothing about correct values. The most common culprit is large integer precision: JSON numbers become IEEE-754 doubles, so an ID like 9007199254740993 silently returns as ...992. Anything above 253-1 should travel as a string.
The same applies to long decimals, which get rounded to about 17 significant digits. Beyond numbers, a payload can be perfectly valid JSON yet fail your schema — a missing field, a number where a string was expected, null where an object was expected. A validator checks grammar; a schema checks meaning.
What is the difference between Format and Minify?
Format adds indentation and line breaks so a human can read and diff the structure. Minify strips every optional space and newline into one line so a machine can transfer it faster.
The saving is real but modest: a typical order payload here goes from 449 bytes at 2-space indent to 290 minified, about 35% — or 48% if it was indented with 4 spaces. Note that gzip, which almost every server already applies, compresses repeated whitespace very efficiently, so minifying on top of compression gains far less than the raw numbers suggest. Use Format while debugging, Minify for storage or payloads that are not gzipped.
Is my data sent to any server?
No. Parsing uses the browser's built-in JSON.parse, and the highlighting is done in this page's own JavaScript. There is no upload, no logging and no analytics attached to the editor.
You can confirm it in seconds: open developer tools, switch to the Network tab and format something — no request appears. Once the page has loaded you can disconnect from the internet entirely and it still works, which is what makes it safe for API keys, tokens and customer records.
