{}JSON-Validator.net
Guide · 5 min read

How to Validate JSON

JSON validation is the process of checking whether a JSON string conforms to the JSON specification (RFC 8259). This guide explains what makes JSON valid, walks through the most common errors, and shows you how to fix them instantly using an online JSON validator.

What Makes JSON Valid?

JSON (JavaScript Object Notation) is defined by RFC 8259. A valid JSON document must follow six rules:

Double quotes only: All strings and keys must use double quotes. Single quotes (') are not valid JSON.
No trailing commas: The last item in an object or array must not be followed by a comma.
Quoted keys: Object keys must always be strings wrapped in double quotes. Unquoted keys are invalid.
No comments: JSON does not support // or /* */ comments. Remove all comments before parsing.
Valid value types: Values must be: string, number, object, array, true, false, or null. Undefined is not valid.
Matched braces & brackets: Every opening { must have a closing }, and every [ must have a closing ].

How to Validate JSON Online — 3 Steps

1
Paste your JSON
Copy your JSON string and paste it into the validator editor above.
2
Read the result instantly
A green banner means your JSON is valid. A red banner with an error message means it is not — the message tells you exactly where the problem is.
3
Fix and re-validate
Correct the error in the editor and the validator updates in real time as you type.

Common JSON Errors Explained

Here are the four errors that account for the vast majority of invalid JSON:

1. Single quotes instead of double quotes

This is the most common error. Developers coming from JavaScript or Python often use single quotes for strings. JSON strictly requires double quotes.

Invalid
{'name': 'Alice', 'age': 30}
Valid
{"name": "Alice", "age": 30}
2. Trailing commas

JavaScript allows trailing commas in arrays and objects. JSON does not. The last element must not be followed by a comma.

Invalid
{
  "name": "Alice",
  "age": 30,
}
Valid
{
  "name": "Alice",
  "age": 30
}
3. Unquoted or numeric keys

In JavaScript, object keys don't need quotes. In JSON, all keys must be strings wrapped in double quotes.

Invalid
{name: "Alice", 1: "one"}
Valid
{"name": "Alice", "1": "one"}
4. Comments

JSON5 and JavaScript allow comments. Standard JSON (RFC 8259) does not. Remove any // or /* */ comments from your JSON before validating or parsing.

Invalid
{
  // user info
  "name": "Alice"
}
Valid
{
  "name": "Alice"
}

JSON vs JSON5 vs JSONC

Standard JSON (RFC 8259) — the universal format used by all APIs, databases, and language parsers. Strict: no comments, no trailing commas, double quotes only.

JSON5 — a superset of JSON that allows comments, trailing commas, and single quotes. Used in some config files. Not supported by standard parsers.

JSONC — JSON with Comments. Used by VS Code config files (settings.json, tsconfig.json). Also not parseable by standard JSON.parse().

This validator checks against standard RFC 8259 JSON — the format used by all APIs and language parsers.

Ready to Validate Your JSON?

Free, instant, and 100% private — your JSON never leaves your browser.

Open JSON Validator

Related Guides