How to use
- Paste your JSON into the box. It is checked as you type.
- Choose Format (2 spaces, 4 spaces or tabs) or Minify, and optionally sort the keys A → Z.
- If the JSON is invalid, read the line, column and reason, fix that spot, and the result updates.
- Press Copy JSON to take the output.
Your JSON never leaves your browser, so API keys and customer data stay private.
How the validator works
JSON is defined by RFC 8259 and ECMA-404. A JSON text is one value: an object {}, an array [], a string in double quotes, a number, true, false or null. The rules people trip over most:
- No trailing commas after the last item.
- Double quotes only, for both names and strings.
- No comments, and no
NaN,Infinityorundefined. - No leading zeros in numbers: write
7, not07.
The checker reads the text character by character, so it can point at the first problem. Numbers and strings are copied exactly as typed, so nothing is rounded.
Example
This input has trailing commas:
{
"name": "Ada",
"skills": ["math", "poetry",],
}
The checker reports line 3, column 31: trailing comma, remove the comma before “]”. Fix it, and the one after ], and the JSON is valid.
Formatting the sample object (87 bytes minified) with 2-space indents gives 10 lines and 121 bytes. Minifying removes those 34 bytes again; the data is identical.
Big numbers, duplicate keys and other details
- Big numbers: JavaScript’s
JSON.parserounds12345678901234567890to12345678901234567000, because doubles are exact only up to 9,007,199,254,740,991. This formatter keeps the digits as written. - Duplicate keys are allowed by the grammar, but RFC 8259 says names SHOULD be unique. You get a warning, because programs disagree on which value wins.
- Sorting orders keys by character code (uppercase before lowercase), at every level. Arrays keep their order.
- Nesting is limited to 1,000 levels, as RFC 8259 allows parsers to do.
Need to send the JSON inside a link? The Base64 encoder or the URL encoder will make it safe to paste.