Format JSON online, validate JSON syntax, minify payloads, sort keys and inspect parse errors in your browser.
JSON (JavaScript Object Notation) is a strict text format: keys and string values must use double quotes, there are no trailing commas, comments are not allowed, and the document is a single value — usually an object or array, although a lone string, number, true, false or null is also valid JSON. This JSON formatter and validator re-indents valid JSON so the structure is readable and points to the line and column where parsing fails.
Beautify expands the document with consistent indentation and one value per line — ideal for reading and diffing. Minify strips every non-essential character to produce the smallest payload for transport. Sort keys helps compare API responses and configuration files; for natural ordering, pinned keys and exact number preservation use the JSON Sort tool. All parsing runs entirely in your browser; the JSON you paste is not uploaded.
Objects copied from JavaScript code or a config file often look like JSON but are rejected by a strict parser:
{ 'user': { id: 42, roles: ['admin', 'dev'], }, active: true }
The status bar switches to Invalid JSON and shows the parser message with a line and column — here line 1, column 3, the first single quote. Wrap every key in double quotes, replace the single-quoted strings and drop the trailing comma after the array:
{"user":{"id":42,"roles":["admin","dev"]},"active":true}
With the default 2-space indent, the corrected document formats to 10 lines. The status bar reports
6 nodes
(the keys
user,
active,
id,
roles
plus the two array items),
depth 4
(root object →
user
→
roles
→ array item) and a size of 99 B. Pressing Minify on the same input produces the single-line version above, which is 56 B.
JSON.parse
accepted the input. When parsing fails, the output and tree are cleared so stale results never sit under an error.
{"a":1}
has depth 2.
{ }
and arrays show
[ ]
with their child count; array items are labelled by index. Collapse all keeps the root open.
Copy and Download (saved as
formatted.json) use the plain formatted text, without the line-number gutter.
curl
or browser dev tools to see its structure and find a nested field in the tree.
| Symptom | Likely cause | Fix |
|---|---|---|
Error points at a closing } or ] |
Trailing comma after the last item | Remove the comma |
| Error at the first character of a key | Unquoted or single-quoted key | Wrap keys in double quotes |
Error at / or # |
Comments (JSONC, JSON5 or YAML habits) | Delete comments; JSON has none |
Error at NaN, Infinity or undefined |
JavaScript values that JSON does not define | Use null, a number or a string |
| Error at the very start of text that looks fine | Invisible byte-order mark (BOM) or a log prefix before the JSON | Re-save without BOM or trim the prefix |
| Error inside a string value | Raw line break or tab, or an unescaped " |
Escape as \n, \t, \" |
The error wording comes from your browser's JSON engine, so Chrome, Firefox and Safari phrase it differently. The line and column show where parsing stopped, which is usually at or just after the real mistake.
9007199254740993
becomes
9007199254740992) and notation is normalized (1.50
→
1.5,
1e3
→
1000). If exact digits matter, keep the original text or use
JSON Sort, which preserves numbers exactly.
\u00e9
is output as
é
and
\/
as
/. The data is identical, but a byte-for-byte diff against the original will differ.
item10
sorts before
item2, and integer-like keys such as
"2"
and
"10"
always come first in numeric order. Array order is never changed.
No. Parsing, formatting, minifying, sorting and validation all run client-side in your browser using the native JSON engine. Nothing is sent to a server.
The usual culprits are trailing commas, single quotes instead of double quotes, unquoted keys, or comments — all valid in JavaScript objects but not in JSON. The error message points to the exact line and column where parsing stopped.
It recursively reorders every object's keys alphabetically before formatting. This makes two JSON documents directly comparable in a diff even when the original key order differed.
Everything runs in your browser, so the practical limit is your device memory. Documents up to a few megabytes format instantly; very large files may take a moment to build the tree view.
The formatter parses numbers as JavaScript numbers, which are exact only up to 2^53 (9007199254740991). Larger integers, such as 64-bit IDs, are rounded, and notation like 1.50 or 1e3 is normalized to 1.5 or 1000. Send large IDs as strings, or use JSON Sort, which preserves numbers exactly.