JSON Formatter and Validator

[ OUTPUT ]
{ "employee": "Juan dela Cruz", "monthlySalary": 30000, "allowances": [ { "type": "transport", "amount": 2000 } ], "regular": true, "separatedOn": null }
Size161 B
Keys7
Depth3 levels
[ WHAT THIS IS ]

Validate a document, pretty print it at the indent you want, minify it for the wire, or sort every object's keys so two versions of the same file can be compared.

The document is parsed here rather than handed to the browser's own JSON reader, for three reasons. The browser's parser does not tell you reliably WHERE an error is — the wording and the position differ between Chrome, Safari and Firefox — so it could not point at a line. It turns every number into a floating-point value, which rounds long ids and drops trailing zeroes, corrupting a document you only asked to tidy. And it silently discards duplicate property names, which is the exact kind of quiet wrongness worth catching.

Strings are the one thing rewritten rather than preserved: A becomes A. That changes the bytes but not the value, so nothing is lost — unlike a number, where the two really would differ.

[ QUESTIONS ]

Where exactly is my syntax error?

The page gives the line and the column, prints the offending line, and puts a caret under the character that broke it. Most JSON errors are a missing comma, a trailing comma or an unclosed brace, and all three are invisible until something points at them.

Why does it complain about a trailing comma?

Because JSON does not allow one, even though JavaScript, Python and most config formats do. This is the single most common JSON error. JSON5 and JSONC allow trailing commas and comments — if your file has either, it is not JSON, whatever the extension says.

Will formatting change my numbers?

No, and that is deliberate. Most formatters parse a number into a float and write the float back, which silently rounds a long id — 1234567890123456789 becomes 1234567890123456800 — and turns 1.0 into 1. This keeps every number exactly as you wrote it, digit for digit.

What is a duplicate key and why should I care?

JSON does not forbid the same property name twice in one object, and nearly every parser silently keeps the last one. So {"amount": 500, "amount": 50} is a valid document that quietly becomes 50. This finds them, tells you the line, and keeps both — a formatter should never be the thing that deleted a line of your data.

Does sorting keys change the meaning of my document?

No. Property order is not significant in JSON, so a sorted object is the same object. Array order IS significant and is never touched. Sorting is by character code rather than by locale, so the same file sorts the same way on every machine — a sorted file that still shows a diff would defeat the point.

Is my data uploaded anywhere?

No. The parser is JavaScript running in this tab, and no request carrying your document is ever made. That matters here more than on most pages, because the JSON people paste into a formatter is very often a real API response with real customer records in it.

[ WHAT IT CHECKS ]
The three commonest errors
{"a": 1,}  — trailing comma
{a: 1}     — unquoted name
{'a': 1}   — single quotes

All three are legal JavaScript and none is legal JSON. Each is named for what it is rather than reported as an unexpected token.

[ NUMBERS ARE NOT TOUCHED ]
A 19-digit id, formatted
parse, then re-print …3456800
kept verbatim …3456789

A double holds about 15 significant digits. Anything longer — a Twitter id, a Snowflake, a bank reference — comes back wrong from a formatter that round-trips through a float.

[ WHAT IT MEASURES ]
Size UTF-8 bytes, not characters
Depth nesting levels
Keys every property name, duplicates included
[ NEXT ]
44Base64 Encoder / DecoderUTF-8 safe, both alphabets, nothing transmitted
42Password GeneratorCryptographic randomness, entropy reported honestly
41QR Code GeneratorEncode a link or Wi-Fi details as a scannable code
39Unit ConverterLength, weight, temperature and four more
[ IMPORTANT ]

Documents are parsed strictly to RFC 8259. JSON5 and JSONC — comments, trailing commas, unquoted keys — are reported as errors rather than accepted. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.