What does a JSON validator check?
A JSON validator tells you whether a piece of text is well-formed JSON as defined by RFC 8259 (the IETF standard, identical in syntax to ECMA-404). A single misplaced comma or quote makes the whole document unreadable to JSON.parse, json_decode, json.loads and every other parser, so validating before you ship a config file, an API payload or a webhook fixture saves a lot of guesswork.
This validator runs a strict scanner of its own alongside the browser's native parser. That means every error gets the same clear message in every browser — "Trailing comma before ']'", "Property names must be wrapped in double quotes" — with the exact line and column and an excerpt of the surrounding code with a caret under the problem, instead of the cryptic "Unexpected token" you get from the console.
It also flags problems that are technically parseable but dangerous: duplicate keys, which JSON.parse resolves by silently keeping the last value, integers larger than 2^53 that JavaScript rounds without warning, and a leading byte order mark. Everything happens locally in your browser; nothing you paste is uploaded.
How to use the JSON Validator
- Paste your JSON into the input box, or click Sample or Broken sample to see how results are reported.
- Read the verdict as you type. If the JSON is invalid, the error names the problem and shows the line and column with a code excerpt pointing at it.
- Fix the error in the input box; the result updates automatically, and the next error (if any) is shown.
- Once the document is valid, review any warnings about duplicate keys or unsafe numbers, and check the stats for the root type, key count and nesting depth.
Example
A trailing comma is the most common reason valid-looking JSON fails. For {"tags": ["json", "validator",]} the validator reports "Trailing comma before ']' is not allowed" with this excerpt:
1 | {"tags": ["json", "validator",]}
| ^The JSON rules in RFC 8259, briefly
- A JSON text is exactly one value: an object, array, string, number,
true,falseornull. Since RFC 7159, a bare string or number at the root is valid too. - Strings and property names use double quotes only. Inside strings, control characters (including raw tabs and line breaks) must be escaped as
\t,\n,\uXXXXand so on. - Numbers are decimal: no leading zeros (
07), no leading plus sign, no hex, no.5or5., and noNaNorInfinity. - Commas separate items; there is no trailing comma after the last item, and comments are not part of the format.
- Whitespace between tokens is limited to space, tab, line feed and carriage return. A non-breaking space copied from a web page is an error.
- Object names "SHOULD be unique". The spec does not make duplicates illegal, but says behaviour is unpredictable — which is why this tool warns about them.
Why duplicate keys matter
Given {"role": "user", "role": "admin"}, JavaScript and Python keep admin, while some streaming parsers keep user and strict ones throw. Attackers have used this disagreement to smuggle values past a validator that reads one copy while the application reads the other. Duplicates usually come from hand-edited config files or string-concatenated JSON, and the fix is simply to remove one of them.
Frequently Asked Questions
Why does my JSON work in JavaScript but fail here?
Probably because it is a JavaScript object literal, not JSON. JavaScript allows unquoted keys, single quotes, trailing commas, comments and undefined; JSON allows none of them. The error message tells you which rule was broken.
Is JSON with comments (JSONC) or JSON5 valid?
Not as standard JSON. Files like tsconfig.json or VS Code settings use JSONC, a superset that tolerates comments and trailing commas, and JSON5 goes further. Remove comments and trailing commas before sending the data to a strict parser or an API.
What does "number loses precision" mean?
JSON itself has no size limit for numbers, but JavaScript stores them as 64-bit floats, which represent integers exactly only up to 9,007,199,254,740,991. A 19-digit ID such as a Twitter/X snowflake is silently rounded, so APIs usually send such IDs as strings.
Does this validate against a JSON Schema?
No. This tool checks syntax — whether the text is well-formed JSON. JSON Schema validation checks whether well-formed data has the right shape (required fields, types, ranges) and needs a schema document as a second input.
Can I validate very large files?
Yes. Validation runs after you pause typing and handles multi-megabyte documents on a typical laptop. To explore a large valid document, open it in the JSON Viewer; to make it readable, use the JSON Formatter.