How to format and validate JSON
JSON is the format APIs, config files and databases use to move structured data around — and it is strict. One misplaced comma and the whole document is rejected, usually with an error message that names a position but not the mistake. This tool closes that gap: paste the text, and it either formats it or shows the first error with its exact line and column, the offending line, and a caret under the offending character, plus a plain-English explanation of what went wrong and how to fix it.
- Paste your JSON into the box above, or open a
.jsonfile. Validation runs as you type. - Read the verdict. Valid JSON shows its type, size and structure. Invalid JSON shows the error, its position, and a caret — click Jump to the error to land on it in the editor.
- Format, Minify or Sort keys — or click Repair if the input is JSON-ish but not quite JSON (see below).
- Copy or download the result. Nothing you pasted is stored anywhere.
The three errors that break almost every pasted JSON
Nearly every invalid JSON document a developer pastes has one of three causes, and all three come from copying text out of a programming language instead of out of a JSON document.
1. Trailing commas. JavaScript object literals allow a comma after the last item; JSON does not. This is the single most common error in pasted API payloads:
{ "name": "Ada", "age": 36, } ← the comma after 36 is illegal in JSON
{ "name": "Ada", "age": 36 } ← remove it and the document is valid
2. Single quotes. JavaScript and Python both accept single-quoted strings; JSON accepts only double quotes — for keys as well as values:
{ 'name': 'Ada' } ← invalid: single quotes
{ "name": "Ada" } ← valid: double quotes
3. Unquoted keys. In JavaScript you can write {name: "Ada"};
in JSON the key must be a quoted string:
{ name: "Ada" } ← invalid: the key is bare
{ "name": "Ada" } ← valid: the key is quoted
Click Repair and the tool fixes all three at once — it strips trailing
commas, converts single-quoted strings and keys to double quotes, quotes bare keys and bare
words used as values, and removes // and /* */ comments — then
re-validates and tells you exactly what it changed. If the result still does not parse, it
shows the remaining error instead of pretending the fix worked.
Why large numbers change in most formatters
Most formatters run your JSON through JSON.parse, which converts every number
into a JavaScript 64-bit floating-point number. A double holds about 15–16 significant digits
exactly — anything longer is rounded, silently. An order ID of
9007199254740993 becomes 9007199254740992, and a price of
1.10 becomes 1.1. For IDs, order numbers and money, that is data
corruption, and no error is ever shown. This tool never converts a number to a JavaScript
number: it keeps each numeric literal exactly as you typed it and re-prints it
digit-for-digit. When a number is large enough that other formatters would have rounded it,
an amber notice names it, so you know what was protected.
Duplicate keys: the silent bug
JSON technically allows the same key twice in one object, but almost every parser keeps only
the last value and drops the earlier one without a word — so
{"id": 1, "id": 2} reads as {"id": 2} and the first value vanishes.
That usually means a copy-paste error or two systems writing the same field. This tool flags
every duplicate key with its line and column, and keeps both copies in the formatted output,
so you can see the conflict instead of discovering it in production.
Format, minify, or sort keys — which do you need?
Format is for reading: it re-prints a minified API response with indentation and line breaks. Minify is for sending: it strips every byte of whitespace for the smallest valid document, which is what you paste into a request body or store. Sort keys is for comparing: alphabetical keys at every level make two versions of the same document diff cleanly, instead of hiding a one-value change inside a re-ordered object. All three leave values untouched — including large numbers, which stay exactly as written.
Honest limitations
No schema validation
This tool checks syntax only — whether the text is well-formed JSON. It does not check whether the data matches a JSON Schema, an API contract, or your expected shape.
Repair is best effort
Repair fixes the common JSON-ish mistakes. It cannot invent a missing value, close a string it cannot find the end of, or guess what a garbled document was meant to say — and it says so when it fails.
Very large pastes are slower
Formatting itself is fast, but syntax highlighting runs on the main thread, so a multi-megabyte paste can feel sluggish. Live checking pauses above 200 KB; use the Format button instead. Files over 5 MB are refused outright.
Strict JSON, not JSON5 or JSONC
Comments, trailing commas and single quotes are repaired, not accepted as valid. If you work with JSON5, JSONC or NDJSON daily, those formats need a dedicated parser — pasting them here will report the first non-JSON construct as an error.