JSON Validator
Validate JSON syntax online and get exact error line numbers with column positions. Works on minified or formatted JSON — no signup required.
About the JSON Validator
The DevToolHeaven JSON Validator checks your JSON data against the official JSON specification and reports any syntax errors with exact line and column numbers. Unlike a formatter, the validator focuses entirely on correctness — giving you a clear, actionable report of what is valid and what needs fixing.
Use strict mode for standard JSON files like API responses and data files. Switch to permissive mode for configuration files like tsconfig.json or .eslintrc that use JSON with comments or trailing commas. Permissive mode strips single-line (//) and multi-line (/* */) comments and removes trailing commas before validating, making it compatible with JSONC and JSON5 formats.
The most common validation failures are: trailing commas after the last element in an object or array, single-quoted strings (JSON requires double quotes), unquoted property names, JavaScript-style comments, undefined or NaN values, and mismatched or missing brackets. Each of these is reported with the specific line and column where the parser stopped.
Understanding error positions prevents confusion. When JSON is invalid, the reported line and column indicate where the parser gave up — which is often one character after the actual mistake. A missing comma on line 5 might be reported at the beginning of line 6. Reading back one token from the error position usually reveals the true cause.
JSON validation is a critical step in API development, CI/CD pipelines, and data ingestion workflows. Validating API responses before parsing them prevents runtime exceptions. Validating configuration files before deployment catches typos before they cause outages. For structural validation — checking field names, types, and value constraints — look into JSON Schema.
All validation happens entirely in your browser. No data is ever sent to a server — your API tokens, credentials, or proprietary configuration values are never transmitted anywhere.
Frequently Asked Questions
JSON validation checks whether a string of text conforms to the JSON specification. Valid JSON must use double quotes for strings, have no trailing commas, no comments, and properly matched brackets and braces.
The most common JSON errors are: missing or extra commas, single quotes instead of double quotes, trailing commas after the last item, unquoted property names, JavaScript-style comments, and mismatched or missing brackets.
Strict mode follows the official JSON specification exactly. Permissive mode strips JavaScript comments and trailing commas before validating, which is useful for JSON5 or JSONC formats used in configuration files like tsconfig.json.
Standard JSON does not support comments. However, some configuration file formats like JSONC (JSON with Comments) and JSON5 do allow comments. Use permissive mode on this validator to handle those formats.
When JSON is invalid, the validator shows the exact line and column where the error was detected. Note that the error is often just after the actual mistake — for example a missing comma on line 5 might be reported at the start of line 6.
The JSON Validator focuses purely on checking whether JSON is valid and reporting errors clearly. The JSON Formatter also validates but additionally reformats the output with indentation. Use the Validator when you just need a quick syntax check.
This tool validates JSON syntax — confirming it is correctly formatted per the JSON specification. Schema validation (checking that required fields exist, data types are correct, values are within allowed ranges) is a separate concern handled by JSON Schema (draft-07, 2019-09, 2020-12). Libraries like Ajv (JavaScript) or jsonschema (Python) are commonly used for schema validation in code.
JSON validation confirms a document conforms to the JSON specification — it is either valid or invalid. JSON linting typically goes further, enforcing style rules like key ordering, maximum nesting depth, or line length limits. For pure syntax checking, this validator is sufficient. For enforcing team coding standards, tools like Prettier or ESLint with a JSON plugin are more appropriate.
Use JSON.parse() wrapped in a try/catch: try { const data = JSON.parse(responseText); } catch (e) { console.error("Invalid JSON:", e.message); }. For more detailed error positions, paste the response into this validator — it shows the exact line and column of the problem.
JSON5 is a superset of JSON that adds JavaScript-style comments, trailing commas, single-quoted strings, and unquoted keys. It is NOT valid standard JSON. Tools like VS Code use JSON5 for tsconfig.json and settings files. Use the Permissive mode on this validator to strip JSON5 features before validating.
Your application may be using a stricter parser, or the JSON may contain invisible characters like a UTF-8 BOM (byte order mark) at the start of the file. Try pasting directly from your application rather than copying from a browser view. Also check that the Content-Type header is set to application/json if validating an API response.
In Node.js, wrap JSON.parse() in a try/catch: try { const obj = JSON.parse(str); } catch (e) { console.error(e.message); }. For file validation, read the file first: const str = fs.readFileSync("data.json", "utf8"); then parse. For schema validation (checking field types and required values), use the Ajv library.