How to validate JSON
- Paste your JSON into the box. Validation runs automatically as you type.
- A green Valid JSON message confirms the syntax, along with the size and nesting depth.
- If it’s invalid, you’ll see the line and column of the first error and the faulty line with a marker under the exact position.
Examples of invalid JSON
| Invalid | Why | Fix |
|---|---|---|
{"a": 1,} |
Trailing comma | {"a": 1} |
{'a': 1} |
Single quotes | {"a": 1} |
{a: 1} |
Unquoted key | {"a": 1} |
{"a": 1 // note} |
Comments aren’t allowed | Remove the comment |
When to validate JSON
- Before committing configuration files, where one stray comma can break a deployment.
- When an API rejects a request body with a vague parse error.
- When hand-editing JSON data or translation files.
Once your JSON is valid, the JSON Formatter makes it readable.
Frequently asked questions
What are the most common JSON errors?
Trailing commas after the last item, single quotes instead of double quotes, unquoted keys, comments (JSON doesn't allow them), and unescaped line breaks or quotes inside strings.
Does this validate against a JSON Schema?
No — it checks that the text is well-formed JSON according to the JSON specification (RFC 8259). Schema validation checks structure and types, which is a separate step.
Why does my JavaScript object fail validation?
JavaScript object syntax is more relaxed than JSON. JSON requires double-quoted keys and strings and doesn't allow trailing commas, comments, undefined, functions or NaN.