Data validation
JSON Validator
Paste JSON to validate it instantly. Get clear error messages with line numbers so you can fix problems fast.
What Makes JSON Invalid?
JSON is a strict format — a single character out of place will cause a parse failure. The most common mistakes are using single quotes instead of double quotes for strings, leaving a trailing comma after the last item in an object or array, forgetting to quote property keys, and using JavaScript-style comments (// comment), which are not valid JSON. This tool identifies the exact line and position of the error so you can fix it without guessing.
Common JSON Errors
Trailing commas are the most frequent mistake: {"a": 1, "b": 2,} is invalid because of the comma after 2. Single-quoted strings are another common error from JavaScript developers: {'key': 'value'} must be written as {"key": "value"}. Unquoted keys like {key: "value"} are valid JavaScript object syntax but invalid JSON. If you need to format valid JSON after fixing errors, use our JSON Formatter.
JSON vs JavaScript Objects
JSON is a data interchange format derived from JavaScript, but it is stricter than JavaScript object syntax. JSON requires double quotes for all strings and keys, does not allow trailing commas, does not support undefined, does not support functions, and does not support comments. A JavaScript object literal that looks valid may not be valid JSON. Always validate before sending data across a network or writing to a file.
Validating Nested Structures
This tool reports the depth of nesting and the total key count, which helps identify unexpectedly deep structures that may cause performance issues in some parsers. Very deeply nested JSON (10+ levels) is often a sign of a data modelling problem worth addressing at the source.
Frequently Asked Questions
- Why is my JSON showing as invalid when it looks correct?
- The most common hidden causes are: a trailing comma after the last item in an object or array, single quotes instead of double quotes around strings or keys, an unquoted key name, a JavaScript comment inside the JSON, or a
NaNorInfinityvalue (which are valid JavaScript but not valid JSON). The error message and line number will point you to the exact location of the problem. - What is the difference between JSON validation and JSON formatting?
- Validation checks whether the JSON is syntactically correct — it tells you whether it can be parsed at all. Formatting (or prettifying) takes valid JSON and adds consistent indentation and line breaks to make it human-readable. You must have valid JSON before formatting — a formatter cannot fix broken JSON, only rearrange correct JSON. Use this validator first, then use the JSON Formatter once the JSON is valid.
- Can JSON contain comments?
- No. Standard JSON (RFC 8259) does not support comments of any kind. This is a deliberate design decision — JSON is a data format, not a configuration language. If you need comments in a configuration file, consider JSONC (JSON with Comments, used by VS Code), JSON5, or YAML instead. Any JSON containing
// commentor/* comment */will fail to parse in any standard JSON parser. - What are the valid data types in JSON?
- JSON supports exactly six data types: string (double-quoted), number (integer or decimal, no NaN or Infinity), boolean (
trueorfalse), null, object (key-value pairs in curly braces), and array (ordered list in square brackets). Types not supported include undefined, functions, Date objects, RegExp, Symbol, and BigInt. Dates are typically stored as ISO 8601 strings. - How do I validate a large JSON file?
- Paste the full content into the input area — this tool handles large JSON entirely in the browser with no size limit other than available memory. For files larger than a few megabytes, the browser may take a moment to parse. If you regularly work with very large JSON files, command-line tools like
jqor Python'sjson.toolmodule (python3 -m json.tool file.json) are more efficient for that scale. - Is there a size limit for JSON I can validate here?
- There is no enforced size limit. All processing happens in your browser using JavaScript's built-in JSON parser, so the only limit is your browser's available memory. In practice, JSON files up to several hundred megabytes can be validated without issues on modern hardware, though very large files may take a few seconds to parse.