TOOLS WORLD logoTOOLS WORLD

JSON Validator

Validate JSON against the official specification and get the exact line and column of any syntax error, with a clear explanation of what went wrong.

What is a JSON validator?

A JSON validator checks whether a piece of text is syntactically correct JSON according to the official specification, RFC 8259. When the document is valid, you get a clear confirmation along with a summary of what the document contains. When it is not, you get the thing that actually matters: the exact line and column where parsing failed, plus the parser's explanation of what it expected to find there.

This matters because JSON errors in the wild are usually silent and confusing. An application might log a vague Unexpected tokenmessage, a CI pipeline might fail with no context, or an API might reject your request body with a generic 400 error. Pasting the offending document into a validator turns minutes of squinting into an instant answer. Validation runs entirely in your browser with the JavaScript engine's native parser - the same strict parser used by Node.js and every modern browser - so the verdict you get here is the same verdict your production code will give.

How to use the JSON validator

  1. Paste your JSON into the text area. It can come from an API response, a configuration file, a log line, or anywhere else. You can also click Load sample (invalid) to see how error reporting works.
  2. Click Validate JSON. The result appears immediately below the button.
  3. If the document is valid, a green banner confirms it and summarizes the top-level structure - for example, “an object with 4 keys” or “an array with 250 items”.
  4. If the document is invalid, a red banner shows the line and column of the first error together with the parser's message. Go to that location in your source, fix the problem, paste the corrected version, and validate again.
  5. Repeat until valid. Because parsers stop at the first violation, complex documents occasionally need two or three rounds.

Examples

Example 1: trailing comma

{
  "name": "Ada",
  "skills": ["math", "analysis",],
  "active": true
}

The comma after "analysis" makes this invalid. The validator reports an error at line 3 - JSON arrays and objects must not end with a trailing comma. Deleting that one character makes the document pass.

Example 2: single quotes

{'name': 'Ada'}

This is a valid JavaScript object literal but invalid JSON, which requires double quotes around both keys and string values: {"name": "Ada"}.

Example 3: valid document

{
  "service": "payments",
  "retries": 3,
  "endpoints": ["primary", "fallback"],
  "debug": null
}

This passes, and the validator summarizes it as an object with 4 keys.

JSON rules worth memorizing

Almost every validation failure traces back to one of a handful of rules where JSON is stricter than JavaScript:

  • Strings and property names use double quotes only.
  • No trailing commas after the last element of an array or object.
  • No comments - JSON has no comment syntax at all.
  • Numbers cannot have leading zeros (01), a leading plus sign, or be NaN / Infinity.
  • The only literals are true, false, and null - all lowercase. undefined does not exist in JSON.
  • Inside strings, double quotes, backslashes, and control characters must be escaped (\", \\, \n).

Validation vs. formatting vs. schema checking

These three operations are related but distinct. Validation (this tool) answers “is this well-formed JSON at all?”. Formatting - see the JSON Formatter - takes valid JSON and rewrites its whitespace for readability or size. Schema checking goes a level deeper and asks whether valid JSON has the right shape: the required fields, correct types, and allowed values defined in a JSON Schema document. A sensible debugging workflow is validate first, format second (so you can read the document), then worry about schema-level correctness.

Practical tips

  • Validate configuration files before deploying - a single trailing comma in a config can take a service down.
  • When hand-editing JSON, edit the formatted version (via the formatter) - errors are far easier to avoid when structure is visible.
  • If you need placeholder IDs while building test payloads, the UUID Generator produces valid unique identifiers in bulk.
  • Debugging a string field that should match a pattern (emails, dates, SKUs)? Prototype the pattern in the Regex Tester before wiring it into code.

Frequently asked questions

What does it mean for JSON to be valid?
Valid JSON conforms to the official JSON specification (RFC 8259): a document must be an object, array, string, number, boolean, or null; all strings and keys must use double quotes; there are no trailing commas; and no comments are allowed. If a strict parser can read your document without errors, it is valid JSON.
How is this different from the JSON Formatter?
The JSON Formatter's job is to reformat valid JSON. The JSON Validator's job is to tell you whether your document is valid and, when it is not, to pinpoint the exact line, column, and reason for the failure. Use the validator when you are debugging 'why won't this parse' problems, and the formatter when you want readable or minified output.
Why is my JSON invalid even though JavaScript accepts it?
JavaScript object literal syntax is more permissive than JSON. JavaScript allows single quotes, unquoted keys, trailing commas, comments, and values like undefined and NaN - none of which are legal in JSON. JSON is a strict subset, so code that works in a JS file can still fail JSON validation.
Does this validator check JSON Schema?
No. This tool checks syntax - whether the document is well-formed JSON. JSON Schema validation is a separate step that checks whether valid JSON matches a particular structure (required fields, types, formats). Syntax validation always comes first: a document that fails here will fail any schema check too.
Is my JSON sent to a server for validation?
No. Validation happens entirely in your browser using the JavaScript engine's native JSON parser. Nothing you paste is uploaded, logged, or stored, so it is safe to validate payloads containing credentials, tokens, or personal data.
Can the validator find more than one error at a time?
It reports the first error it encounters, because JSON parsing stops at the first violation - everything after that point is ambiguous. The practical workflow is: fix the reported error, validate again, and repeat until the document passes. Most documents have only one or two real mistakes.
What are the most common JSON validation errors?
In rough order of frequency: trailing commas after the last element, single quotes instead of double quotes, missing commas between elements, unquoted property names, unescaped double quotes or control characters inside strings, and comments left in the document. The error message and location usually make the culprit obvious.

Related tools

More free tools you might find useful alongside the JSON Validator.