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
- Paste your JSON into the input area.
- Click “Validate” or press
Ctrl+Enter. - 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.
- 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}
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
| Category | Keywords |
|---|---|
| Type | type, enum, const |
| Object | properties, required, additionalProperties, minProperties, maxProperties, patternProperties |
| Array | items, minItems, maxItems, uniqueItems |
| String | minLength, maxLength, pattern |
| Number | minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf |
| Composition | allOf, anyOf, oneOf, not |
| References | $ref (local #/definitions/... and #/$defs/...) |
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:
| Feature | This Validator | JSONLint |
|---|---|---|
| Syntax checking | Yes | Yes |
| JSON Schema validation | Yes | No |
| Structure stats | Yes (type, depth, keys) | No |
| Privacy | Runs in your browser | Sends data to a server |
| Ads | Minimal | Heavy |
| Open source | Yes | Partially |
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/TypeScript —
JSON.parse()for syntax;ajvfor schema validation. - Python —
json.loads()for syntax;jsonschemalibrary for schema validation. - Go —
json.Unmarshal()for syntax;gojsonschemafor schema validation. - Java — Jackson or Gson for syntax;
everit-org/json-schemafor 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.