How to use the JSON Validator
- Paste your JSON into the input, or click Paste to read it from the clipboard.
- Read the result panel. Valid JSON shows the top-level type, key or item count, nesting depth and size.
- For invalid JSON, the panel shows the error line with a caret under the problem and a hint. Jump to error moves your cursor there.
- If the only problem is trailing commas, click Remove trailing commas to fix them in one go.
Features
- Precise error location with line, column and a caret in context
- Hints for the most common mistakes: trailing commas, single quotes, unquoted keys, comments, undefined and NaN
- One-click fix for trailing commas
- Summary of valid documents: type, count, nesting depth, size
- Handles large documents; the native parser is used first for speed
What counts as valid JSON
JSON is defined by RFC 8259. A document is a single value: an object, an array, a string, a number, true, false or null. Object keys must be strings in double quotes, strings use double quotes only with backslash escapes, numbers can't have leading zeros or a leading plus sign, and there are no comments, no trailing commas and no undefined.
Many things that look like JSON are actually JavaScript object literals, JSON5 or YAML. They may work in a JavaScript file but will be rejected by JSON.parse and by most APIs, which is exactly what this validator reports.
How errors are located
Browsers' built-in JSON.parse gives inconsistent, often vague error messages. This tool parses the text with its own position-tracking parser whenever the built-in parser fails, so the reported line and column are consistent across Chrome, Firefox and Safari, and the message describes the actual problem rather than “unexpected token”.