JSON Formatter and Validator
Text & Dev ToolsFormat, minify and validate JSON — errors pinned to line and column, and big numbers never rounded.
What you type never leaves this device. Everything here runs in your browser — your text is never uploaded, stored or seen by us. Open your network tab and check.
Valid JSON
{
"order": 12345678901234567890,
"items": [
{
"sku": "A-1",
"qty": 2,
"price": 19.99
},
{
"sku": "B-7",
"qty": 1,
"price": 5
}
],
"paid": true,
"note": null
}- Keys
- 10
- 3 objects
- Depth
- 3
- 1 arrays
- Input
- 132 bytes
- Output
- 220 bytes
One number is beyond what JavaScript's own JSON.parse can hold, and would silently change it — for example 12345678901234567890 at $.order. They are kept exactly as written here.
How this is calculated
Read strictly, by RFC 8259 — the JSON standard
Keep every number and string exactly as written
Report the first error with its line, column and reason
Write the same values back, changing only whitespace
(and the order of keys, if you ask)How it works
Most JSON formatters read your text with JavaScript's JSON.parse and write it back out with JSON.stringify. That quietly changes data. JSON.parse stores every number as a 64-bit float, which can hold every whole number exactly only up to 9,007,199,254,740,991; past that, many are rounded to a neighbour: the order ID 12345678901234567890 comes back as 12345678901234567000, and 9007199254740993 as 9007199254740992. Large IDs from databases and payment systems are exactly where that goes wrong. This formatter reads the text itself, keeps every number and string as it was written, and changes nothing but the whitespace.
It is strict about what counts as JSON, following the standard, RFC 8259. Comments, trailing commas, single quotes, unquoted keys, NaN and leading zeros are all things other formats allow and JSON does not, and each one gets its own explanation rather than a generic "unexpected token". The error names the line and column and points at the character, which is usually enough to fix it without hunting.
Duplicate keys are kept and reported rather than silently collapsed. The standard says names within an object SHOULD be unique, which makes duplicates legal but unreliable: different programs keep the first value, the last value, or reject the document. If your data has them, you want to know before a different program reads it differently.
Minifying removes every space and line break the standard does not need, which is what you want for storage or a request body. Sorting keys puts object keys in alphabetical order, which makes two versions of the same document much easier to compare line by line.
Worked example
An order record with a 20-digit ID, formatted two ways
- Input {"order":12345678901234567890,"paid":true}
- JSON.parse + JSON.stringify:
- {"order":12345678901234567000,"paid":true}
- — the last four digits are gone, silently
- This formatter:
- {"order":12345678901234567890,"paid":true}
- — kept exactly, and flagged as too precise for JSON.parse
Formatting should only ever change whitespace — here it does
How to use it
- Paste your JSON into the box. It is checked as you type.
- If it is not valid, read the reason and the line and column, and fix the character marked with ^.
- Choose 2 spaces, 4 spaces, tabs or minified, and tick Sort keys if you want keys in alphabetical order.
- Check the notes for duplicate keys or numbers JavaScript would round, then copy the result.
What this tool does not do
- Strict JSON only. JSON5, JSONC with comments, and JSON Lines with one document per line are reported as errors, with the reason.
- It reports the first error it finds. Fix that one and any later error will show next.
- It checks that the text is valid JSON, not that it matches a particular schema or the fields a program expects.
- Documents nested more than 512 levels deep are refused rather than risking the browser tab.
- Very large documents, in the tens of megabytes, can make the page slow, because the whole text is read on every change.
- Columns are counted in characters, so an emoji counts once. Some editors count it as two.
Frequently asked questions
Why does my large number change in other JSON formatters?
Because they use JavaScript's JSON.parse, which stores numbers as 64-bit floats. Whole numbers above 9,007,199,254,740,991 cannot all be stored exactly, so 12345678901234567890 becomes 12345678901234567000. The JSON standard allows parsers to approximate numbers, and warns that numbers like this can cause interoperability problems. This formatter never converts numbers at all, so nothing is rounded.
Does JSON allow comments or trailing commas?
No. Both are common in configuration files written in JSON5 or JSONC, and both make a document invalid JSON. This formatter says which one it found and where, so you can remove it, or confirm that the program you are feeding accepts that looser format.
Are duplicate keys valid JSON?
Technically yes: the standard says keys SHOULD be unique, not that they must. In practice programs disagree about which value to use, so duplicates are a bug waiting to happen. This formatter keeps every one in its original order and lists where they are.
What does minify do?
It removes all the whitespace the standard does not need, so the same data takes fewer bytes. Values and key order are unchanged. The input and output sizes are shown under the result.
Why does it say my JSON has more text after the value?
A JSON document holds exactly one value. Two objects one after the other — which is what a JSON Lines file looks like — is not one JSON document. Wrap them in square brackets with commas between to make an array, or format each line separately.
Is my JSON sent anywhere?
No. It is read and formatted in your browser, and no network request carries it. That matters for API responses, which often contain tokens or personal data. The only requests the page makes once you use it are small ones recording that the tool was used.
Related tools
tell us
Last updated 13 September 2026.