JSON Validator
Free online JSON validator. Check whether your JSON is syntactically valid, get detailed error messages with line numbers, auto-fix common mistakes like trailing commas and single quotes, and inspect the structure with tree view and stats.
How to Use
Paste the JSON you want to check into the input editor. The validator runs automatically as you type.
A green "Valid JSON" badge means your JSON is syntactically correct. A red badge with an error message pinpoints exactly what's wrong.
If your JSON has trailing commas, single quotes, or unquoted keys, click "Auto-Fix" to repair the most common issues automatically.
Once valid, switch to Tree View to browse the JSON structure visually, or Stats to see a full breakdown of objects, arrays, keys, and nesting depth.
What Is JSON Validation?
JSON validation is the process of checking whether a JSON string conforms to the JSON specification (RFC 8259). Valid JSON must use double-quoted strings, properly nested brackets, comma-separated values, and a limited set of value types: strings, numbers, booleans, null, objects, and arrays. A single missing comma, an extra trailing comma, or an unquoted key makes the entire document invalid.
Why Does JSON Validation Matter?
Invalid JSON causes immediate failures in any system that tries to parse it. Common consequences include:
- API failures — A malformed request body or response payload will throw a parse error, breaking the entire operation.
- Config file errors — A single comma out of place in
package.jsonortsconfig.jsonprevents the entire tool or build from running. - Data pipeline crashes — JSON-based data pipelines will fail silently or loudly when receiving invalid input.
- Hard-to-find bugs — JSON syntax errors can be invisible to the naked eye — a missing quote or extra bracket is easy to miss in a large document.
Reading Validation Error Messages
When your JSON is invalid, the error message shown comes directly from the browser's built-in JSON parser. Common messages include: "Unexpected token" (usually a missing comma, quote, or colon), "Unexpected end of JSON input" (an unclosed bracket or brace), and "Expected property name or '}'" (a trailing comma before a closing brace). The error typically includes a line or position number to help you locate the problem.
Common JSON Mistakes
- Trailing commas —
{"a": 1,}is invalid JSON (it's valid in JavaScript, but not JSON). - Single quotes — All strings must use double quotes.
{'key': 'value'}is invalid. - Unquoted keys —
{key: "value"}is JavaScript, not JSON. Keys must be double-quoted strings. - Comments — JSON does not support comments.
// this is invalidin JSON will cause a parse error. - Undefined values —
undefinedis not a valid JSON value. Usenullinstead. - NaN and Infinity — These JavaScript number values are not valid in JSON.
Privacy
All validation happens entirely in your browser. Your JSON is never sent to any server, stored, or logged. You can safely validate sensitive configuration, API payloads, or private data.
Frequently Asked Questions
Paste your JSON into the input box above and click "Validate". A green "Valid JSON" badge means your JSON is syntactically correct and can be parsed by any JSON parser. A red badge displays the specific error message with its location in the document.
The most common JSON errors are: trailing commas before } or ] (valid in JavaScript but not JSON), using single quotes instead of double quotes for strings, unquoted property keys, missing commas between properties or array items, and unclosed brackets or braces. The Auto-Fix button can repair the first three automatically.
JavaScript objects are more lenient than JSON. JavaScript allows trailing commas, single-quoted strings, unquoted keys, comments, and undefined values. JSON (RFC 8259) is stricter — it requires double-quoted strings, no trailing commas, no comments, and no undefined. The Auto-Fix button converts JavaScript-style object notation to valid JSON automatically.
If your JSON is stored as an escaped string (e.g., with \" instead of "), you'll need to unescape it first before validation. Paste it into the input and use the Format button — if the top-level value is a string, you'll see it quoted. For doubly-encoded JSON, you may need to run Format twice to decode both layers.
No. This tool validates JSON syntax — structure and formatting. It does not check whether the data matches a specific schema, whether required fields are present, or whether values are in the correct range. For schema validation against a JSON Schema definition, you would need a dedicated JSON Schema validator.
No. Validation runs entirely in your browser using the browser's built-in JSON.parse() function. Your data never leaves your device. There are no network requests, no server-side processing, and no logging. You can safely validate API credentials, private configs, and sensitive records.