FormatterHQ

JSON Validator

Check whether a JSON document is well-formed. This validator checks syntax, not JSON Schema. Errors are explained in plain English with the exact line and column, and valid input gets a short summary of its structure.

Input JSON
Output JSON
Ready.

How to use the JSON Validator

  1. Paste your JSON, drop a file on the editor or use Upload file or Load URL.
  2. Click Validate. With Auto update on, the check runs again every time you pause typing.
  3. If the status bar shows an error, go to the line and column it names (the line is also marked in the editor), fix it and validate again.
  4. Press Repair to fix common mistakes automatically, or Format to re-indent valid JSON with the chosen Indent.

A JSON validator that explains what is wrong

This JSON validator checks your text against the strict JSON grammar defined in RFC 8259, the same rules that JSON.parse, Python's json module and most API frameworks enforce. When the document is broken, you get a message that describes the actual mistake, such as a trailing comma or a single-quoted string, along with its line and column. It checks syntax, not JSON Schema: to test a document against a schema, use the JSON Schema Validator.

Browsers phrase parse errors differently and sometimes omit the position altogether. The validator runs its own scanner over failing input, so the wording is consistent no matter which browser you use.

Example: finding a trailing comma

This snippet looks fine at first glance:

{
  "id": 7,
  "name": "Ana",
  "tags": ["a", "b",]
}

Validating it stops at Trailing comma before ']' is not allowed (line 4, column 21). Remove the comma after "b" and the result becomes Valid JSON ✓ (1 objects, 1 arrays, 3 keys, depth 2).

Error messages and what they mean

The validator reports the first problem it meets, then stops. Fix it and the next one, if any, will surface.

MessageTypical cause
Strings must be wrapped in double quotes, not single quotes'Ana' copied from JavaScript or Python
Expected a property name in double quotesUnquoted key such as {id: 7}
Comments are not allowed in JSON// or /* */ left in a config file
NaN and Infinity are not valid JSON numbersOutput from a program that serialized a failed calculation
'undefined' is not a valid JSON valueA JavaScript variable that was never set
Literals must be lowercase: true, false, nullTrue, None or NULL from Python or SQL
Unescaped line break inside string (use \n)A multi-line value pasted into a string
Invalid number format (leading zeros, hex and trailing dots are not allowed)007, 0x1F or 1.
Unexpected '{' after the end of the JSON dataTwo documents pasted back to back
Unterminated string: missing closing double quoteA truncated file or a quote that was deleted

Two positions are worth knowing. A comment directly after a value is reported as Expected ',' or '}' but found '/', because the scanner was expecting a separator there. And an error at the very end of the file, such as an object that is never closed, usually points to a missing bracket much earlier.

Reading the success summary

Valid input produces a line like Valid JSON ✓ (2 objects, 1 arrays, 4 keys, depth 3). Objects and arrays are counted at every level, keys is the total number of properties across all objects, and depth is how far the deepest value sits below the root. A bare value such as "hello" is valid on its own and reports zero for everything. The summary is a quick sanity check: if an export should hold 500 records but the array count looks wrong, you know before importing it.

A few inputs pass that people do not expect. A UTF-8 byte order mark at the start is ignored, and duplicate keys are accepted, with the last value winning.

Syntax validation vs schema validation

This page answers one question: is the text well-formed JSON? It does not know whether price should be a number or whether email is required. That kind of check needs a JSON Schema. You can generate a starting schema from a sample document with the JSON to JSON Schema tool and then tighten the rules by hand.

If the file is broken in many places, the JSON fixer or the Repair button here usually handles quotes, commas and comments in a single pass. For files that are meant to contain comments, validate them as JSON5 with the JSON5 formatter instead.

Privacy

Validation is done by JavaScript in your browser and the document is not uploaded. Only Load URL, which fetches the file through our server, and Save & Share, which stores the input for the link, involve the server.

Frequently asked questions

Does the JSON validator check against a JSON Schema?
No. It checks syntax only: quotes, commas, brackets, literals and number formats. To check field types and required properties you need a JSON Schema validator, and you can create a schema from sample data with the JSON to JSON Schema tool.
Why does the validator show only one error at a time?
After the first syntax error the parser cannot know how the rest of the text was meant to be read, so later messages would often be misleading. Fix the reported problem and validate again, or use Repair to fix several common mistakes at once.
Is JSON with duplicate keys valid?
The JSON standard says keys should be unique but does not forbid duplicates, so the validator accepts them. When the data is parsed, only the last value for a repeated key is kept, which is how most programming languages behave as well.
Why is my JSON valid here but rejected by my application?
Syntax is only one requirement. Your application may expect a specific top-level type (for example an object rather than an array), certain fields, or a size limit. Some parsers also reject a byte order mark, which this validator ignores.
Is a single number or string valid JSON?
Yes. Since RFC 7159, any JSON value can be the whole document, so 42, "text" and null are all valid. Some older libraries only accept an object or array at the top level.

Last updated October 3, 2026

Guides

Related tools

JSON Schema Validator Validate JSON against a JSON Schema (draft-07, 2019-09, 2020-12) with Ajv and get every error with its path and rule. Credit Card Validator Check credit card numbers with the Luhn algorithm, detect Visa, Mastercard, Amex and more, and verify length. Runs 100% locally. CSS Validator Validate CSS online: find unclosed braces, missing semicolons and other syntax errors. Email Address Validator Check email address syntax in bulk and flag typos in popular domains, disposable providers, role accounts and duplicates. HTML Validator Validate HTML markup online and find unclosed, mismatched or malformed tags. IBAN Validator Validate IBANs for 80+ countries with the MOD-97 checksum and country length rules, and see bank code and account parts. JSON Viewer & Beautifier View JSON as a collapsible tree and beautify it at the same time. Explore nested objects and arrays without losing your place. JSON5 Formatter Format and beautify JSON5 with comments, unquoted keys and trailing commas, or convert JSON5 to strict JSON. JSON5 Validator Validate JSON5 syntax online. Check config files with comments and trailing commas and get line and column for each error. JSONL to JSON Converter Convert JSON Lines (JSONL / NDJSON) into a formatted JSON array. Invalid lines are reported with their line number. JSONPath Tester Test JSONPath expressions online against your JSON. Supports filters, wildcards, recursive descent and slices, returning values or paths. String to JSON Converter Convert an escaped JSON string back into formatted JSON. Handles quoted literals, backslash-escaped text and double-encoded JSON.