JSON Validator

Validate JSON syntax and check against JSON Schema

What is JSON Validation?

JSON validation is the process of checking whether a string is well-formed JSON according to the ECMA-404 and RFC 8259 specifications. A valid JSON document must have correct syntax — properly quoted strings, matched brackets, no trailing commas, and no comments. Beyond syntax, schema validation checks whether the data structure matches a defined shape: required fields exist, values have the right types, numbers are within bounds, and strings match expected patterns.

Developers validate JSON daily — checking API responses, debugging config files, verifying data exports before import, and testing webhook payloads. A syntax error in a JSON config can crash an application at startup, and a missing required field in an API payload silently drops data.

How to Use the JSON Validator

  1. Paste your JSON into the input area.
  2. Click “Validate” or press Ctrl+Enter.
  3. Read the result: valid JSON shows a green confirmation with structure stats (type, depth, key count); invalid JSON shows the exact error with line and column numbers.
  4. Optionally expand Settings and paste a JSON Schema to validate structure, types, and constraints beyond syntax.

The validator runs entirely in your browser. Nothing is uploaded, nothing is logged.

Common JSON Syntax Errors

Trailing Commas

JSON does not allow a comma after the last element in an array or object. This is the most common error when pasting data from JavaScript code, where trailing commas are legal:

// Invalid — trailing comma
{"name": "Alice", "age": 30,}

// Valid
{"name": "Alice", "age": 30}

Single Quotes

JSON requires double quotes for all strings. Single quotes are a syntax error:

// Invalid
{'name': 'Alice'}

// Valid
{"name": "Alice"}

Unquoted Keys

Every object key must be a double-quoted string. Bare identifiers are not allowed:

// Invalid
{name: "Alice"}

// Valid
{"name": "Alice"}

Comments

JSON has no comment syntax. Lines starting with // or blocks wrapped in /* */ are syntax errors. If you need comments in configuration files, consider JSONC (JSON with Comments, supported by VS Code and TypeScript) or YAML — but standard JSON parsers will reject them.

Missing Commas

Every element in an array and every key-value pair in an object must be separated by a comma:

// Invalid — missing comma between pairs
{"name": "Alice" "age": 30}

// Valid
{"name": "Alice", "age": 30}

Common JSON Error Messages Decoded

Parsers report the same underlying problems with very different wording. Here is what the most common error messages actually mean and how to fix them:

Unexpected token o in JSON at position 1

This JavaScript error usually means you passed an object to JSON.parse() when it expected a string — JSON.parse(obj) first coerces the object to "[object Object]", and the parser chokes on the leading o. If you already have an object, you don’t need to parse it at all; only parse a raw string received from a network response or a file.

Unexpected end of JSON input

The document was cut off — a truncated API response, an unclosed bracket, or an empty string. Check that every {, [, and " has a matching close. Pasting the JSON here highlights the exact point where the structure ends prematurely.

Expecting property name enclosed in double quotes

Python’s json.loads() raises this when an object key uses single quotes or no quotes, or when a trailing comma leaves the parser expecting another key. Convert every key to a double-quoted string and remove trailing commas.

Expecting ',' delimiter

Two values sit next to each other without a comma between them, or a string contains an unescaped double quote that ends it early. The reported line and column point at the first character the parser could not place.

Extra data

Valid JSON was parsed, but more text follows it — most often a second JSON object on the same line (that is NDJSON, not a single document) or a stray character after the closing brace.

Duplicate Keys, Encoding, and Invisible Characters

Some documents parse without a syntax error yet still cause bugs downstream:

  • Duplicate keys. The JSON specification does not forbid repeated keys, but behaviour is undefined — most parsers silently keep the last value, so {"id": 1, "id": 2} collapses to {"id": 2} and data vanishes with no warning. The validator flags duplicate keys so you catch them before they reach production.
  • Byte-order marks (BOM). A file saved as “UTF-8 with BOM” begins with an invisible  character. Many strict parsers reject it with an “unexpected token at position 0” error even though the JSON looks perfect on screen. Re-save the file as plain UTF-8, or strip the BOM before parsing.
  • Smart quotes and non-breaking spaces. Copying JSON out of a word processor, chat app, or PDF can replace straight quotes (") with curly quotes and normal spaces with non-breaking spaces. They look identical but are not valid JSON delimiters. Retype the quotes or paste through a plain-text editor first.

JSON Schema Validation

JSON Schema lets you define the structure your data must follow. Paste a schema into the Settings panel and the validator checks every constraint:

{
  "type": "object",
  "required": ["name", "email"],
  "properties": {
    "name": { "type": "string", "minLength": 1 },
    "email": { "type": "string", "pattern": "^[^@]+@[^@]+$" },
    "age": { "type": "integer", "minimum": 0, "maximum": 150 }
  },
  "additionalProperties": false
}

This schema requires name and email to be present, enforces types and constraints, and rejects any extra fields. The validator reports every violation — not just the first one — so you can fix all issues in one pass.

Supported Schema Keywords

CategoryKeywords
Typetype, enum, const
Objectproperties, required, additionalProperties, minProperties, maxProperties, patternProperties
Arrayitems, minItems, maxItems, uniqueItems
StringminLength, maxLength, pattern
Numberminimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf
CompositionallOf, anyOf, oneOf, not
References$ref (local #/definitions/... and #/$defs/...)

JSON Schema Draft Versions

JSON Schema has evolved through several drafts, and keywords differ between them. Draft-04 used a boolean exclusiveMinimum/exclusiveMaximum and an id keyword. Draft-06 and Draft-07 switched those bounds to numeric values, renamed id to $id, and added const, contains, and the if/then/else conditionals. Draft 2019-09 and 2020-12 moved definitions to $defs and reworked how items handles tuples. This validator targets the widely used Draft-07 keyword set, which covers the overwhelming majority of real-world schemas from OpenAPI definitions, config files, and API contracts. If a keyword from a newer draft appears to be ignored, check which draft your schema declares in its $schema field — mixing keywords from different drafts is a common source of confusion.

JSON Validator vs JSONLint

JSONLint is a popular online JSON validator that has been around since 2011. Both tools check JSON syntax, but there are key differences:

FeatureThis ValidatorJSONLint
Syntax checkingYesYes
JSON Schema validationYesNo
Structure statsYes (type, depth, keys)No
PrivacyRuns in your browserSends data to a server
AdsMinimalHeavy
Open sourceYesPartially

If you need syntax-only checking, either tool works. If you need schema validation or care about keeping your data local, this validator does both without sending anything over the network.

Validating API Responses

When debugging REST APIs, paste the response body here to check both syntax and schema compliance. Common scenarios:

  • Webhook payloads — verify the payload matches the documented schema before writing handler code.
  • Third-party API responses — confirm the structure hasn’t changed after an API version update.
  • Mock data — validate test fixtures match the real schema so tests don’t pass on malformed data.
  • Database exports — check NDJSON (newline-delimited JSON) line by line, or validate a full JSON array export.

Pair this tool with the JSON Formatter to first beautify a minified response, then validate it against your schema.

JSON Validation in Code

For programmatic validation in your codebase:

  • JavaScript/TypeScriptJSON.parse() for syntax; ajv for schema validation.
  • Pythonjson.loads() for syntax; jsonschema library for schema validation.
  • Gojson.Unmarshal() for syntax; gojsonschema for schema validation.
  • Java — Jackson or Gson for syntax; everit-org/json-schema for schema validation.

This online tool is for quick, ad-hoc checks. For production pipelines, integrate a schema validator into your CI — ajv-cli for Node.js projects or check-jsonschema for Python-based CI.

Frequently Asked Questions

How do I validate JSON online?

Paste your JSON into the input area and click Validate or press Ctrl+Enter. The validator checks syntax instantly in your browser — no data is sent to any server. If the JSON is invalid, you get the exact error with line and column numbers so you can fix it immediately.

What is JSON Schema validation?

JSON Schema is a vocabulary that lets you describe the structure your JSON data must follow — required fields, data types, value ranges, string patterns, and more. Paste a JSON Schema into the Schema field (under Settings) and the validator checks your data against it, reporting every violation. This is useful for validating API payloads, config files, and data pipelines.

What is the difference between JSON validation and JSON formatting?

Validation checks whether JSON is syntactically correct and optionally conforms to a schema. Formatting (beautifying) takes valid JSON and re-indents it for readability. Use a JSON validator to catch errors; use a JSON formatter to make valid JSON easier to read. This site offers both tools.

Why does my JSON fail validation?

The most common JSON errors are trailing commas after the last element, single quotes instead of double quotes, unquoted object keys, comments (JSON does not support them), and missing commas between elements. The validator reports the exact line and column of the first syntax error so you can jump straight to the problem.

Can I validate JSON against a JSON Schema?

Yes. Expand the Settings panel below the tool and paste your JSON Schema. The validator supports Draft-04 and Draft-07 keywords including type, required, properties, items, enum, pattern, minimum, maximum, minLength, maxLength, anyOf, oneOf, allOf, not, and local $ref references.

Is my JSON data safe?

Yes. All validation happens entirely in your browser using JavaScript. Your JSON and schema data are never sent to any server, never logged, and never leave your machine.

What is the difference between JSON and JSON5?

JSON is a strict subset of JavaScript with mandatory double quotes, no comments, and no trailing commas. JSON5 extends JSON to allow single quotes, unquoted keys, comments, trailing commas, and more. This validator checks strict JSON — if your data uses JSON5 features, those will be flagged as errors because most APIs and parsers expect standard JSON.

What does 'Unexpected token in JSON' mean?

It means the parser hit a character it did not expect at that position. In JavaScript, 'Unexpected token o in JSON at position 1' usually means you passed an object to JSON.parse() instead of a string. 'Unexpected end of JSON input' means the data was truncated or a bracket was never closed. Paste the JSON here and the validator points to the exact line and column so you can see what tripped the parser.

How do I validate a large JSON file?

Paste the full document into the input area — validation runs entirely in your browser, so even multi-megabyte files never leave your machine and there is no upload limit. For very large files, browser memory is the only ceiling. If the file is newline-delimited JSON (NDJSON), validate one line at a time, since each line is a separate JSON document rather than one big array.

Does JSON allow duplicate keys?

The JSON specification does not forbid duplicate keys, but the result is undefined — most parsers silently keep the last value, so {"id": 1, "id": 2} becomes {"id": 2} and data disappears with no error. The validator flags duplicate keys so you catch this before it causes a silent bug in production.