JSON Schema Validator

Errors found—
Status—
Keys checked—

How JSON Schema Validator is calculated: Check the JSON against the schema's type, required, properties, enum, minimum, maximum, and pattern rules, and list every failure with its path.

What is a JSON Schema validator?

A JSON Schema validator checks a JSON document against a schema — a description of what the JSON should look like — and lists every place where it does not match. Paste the JSON and the schema, and you get a report: either "Valid", or a list of errors with paths such as $.age. The default JSON has 2 keys and matches its schema with 0 errors.

APIs run on contracts, and a schema is the contract. A service that expects {"name": "Ada", "age": 36} will break if it receives {"name": "Ada"} with the age missing, or {"age": "thirty-six"} with the age as a string. Validating before sending catches those mistakes on your machine, not in production.

This validator covers the common schema keywords: type, required, properties, enum, minimum, maximum, pattern, minLength, maxLength, minItems, maxItems, and items. It is a mini-validator for everyday checks, not a full implementation of the JSON Schema specification — the supported keywords are listed in the formula, and anything outside them is ignored rather than guessed at.

How schema validation works

Validation walks the JSON and the schema together, starting at the root, which is called $. At each step it checks the rules the schema gives for that value. The default schema says the root must be an object with required properties name and age, where name is a string and age is an integer of at least 0. The default JSON satisfies all of it, so the error count is 0.

The type check is the first and most important rule. A string where an integer is expected, or an object where an array is expected, is an error at once, and the report names the path — $.age, for example — so you know exactly which value is wrong. The integer type is stricter than number: 36 passes as an integer, but 36.5 does not.

The other checks run after the type check. Required properties must exist; enum values must be one of the listed values; numbers must sit between minimum and maximum; strings must match the pattern and sit between minLength and maxLength; arrays must sit between minItems and maxItems, and each item must match the items schema. Every failure is collected, so one run reports all the errors, not just the first.

The schema keywords, explained

Type is the foundation: string, integer, number, boolean, object, array, or null. A schema that says {"type": "string"} accepts only strings, and a schema that says {"type": ["string", "null"]} accepts either. Getting the type right fixes most validation errors before they happen.

Required and properties describe objects. Required lists the keys that must exist — the default schema requires name and age — and properties gives the schema for each key. A key that is present but has the wrong type is an error, and a required key that is missing is an error too. Extra keys that the schema does not mention are allowed, which is the standard behaviour.

Minimum, maximum, and pattern describe values. Minimum and maximum bound numbers — age with a minimum of 0 rejects -5 — and pattern is a regular expression that a string must match, such as ^[A-Z]{2}[0-9]{4}$ for a code. Enum lists the allowed values exactly, which suits fields such as status with the values active, paused, and closed.

The required keyword is the one people misunderstand most, because it does not say what a value must be — it says which keys must be present. A schema that lists name as required will reject a document with no name key, but it will accept a document where name is an empty string, because the value is not the keyword's business. To control the value, pair required with a second keyword: minLength for a string, or a type plus a minimum for a number. The two keywords together say what required alone cannot: the key must be there, and its value must be usable.

A worked example: a user record

Take the default JSON: {"name": "Ada", "age": 36}. The schema requires name and age, with name a string and age an integer of at least 0. The JSON has 2 keys, both present, both the right type, and the age is above the minimum — so the report is "Valid: the JSON matches the schema." with 0 errors.

Now break it. Change the age to "thirty-six" and the validator reports "$.age: expected integer, got string". Remove the age entirely and it reports "$: missing required property \"age\"". Set the age to -5 and it reports "$.age: -5 is less than minimum 0". Each error names its path, so the fix is obvious.

Try a second document against the same schema — {"name": "Grace", "age": 40, "city": "Paris"} — and it validates, because the extra key city is allowed. Schemas describe what must be true, not what must be absent, which is why an extra field never fails validation on its own.

Who uses a JSON Schema validator, and why

API developers are the main users. A request body must match the API's schema, and a response must match the documented schema, and validating both sides catches contract breaks before they reach production. A validator is the fastest way to answer "is this payload correct?"

Backend engineers are the second group. A config file, a webhook payload, or a database record that must follow a shape can be validated at the boundary, so bad data is rejected with a clear error instead of causing a failure three steps later.

Frontend developers are a third group. A form that builds a JSON object can validate it against the API's schema before sending, which gives the user a clear error message instead of a server rejection. A JSON validator checks whether the JSON parses at all, which is the step before this one.

API teams are a third group. An API that accepts JSON needs to reject bad input before it reaches the database, and a schema is the contract that says what good input looks like. The validator is where that contract is tested: paste a sample request and the schema, and the errors show whether the contract matches the real traffic. A contract that rejects real requests is a bug, and the validator finds it before the API ships.

Schema validator vs JSON validator

A JSON validator checks syntax; a schema validator checks meaning. The JSON validator on this site tells you whether {"name": "Ada"} parses — it does. This tool tells you whether it matches a schema that requires an age — it does not. Syntax is the first check, schema is the second.

Both tools share the same design: paste, check, read the report. Use the JSON validator when a file will not parse at all, and the schema validator when it parses but the API still rejects it — the schema report usually names the exact field the API objected to.

A JSON formatter tidies JSON that is already valid, and a JSON-LD validator checks structured data markup, which is JSON with a schema of its own. Together the four tools cover the whole JSON workflow: parse it, validate it, format it, and query it.

Common schema validation mistakes

The first mistake is writing the schema from memory instead of from the API's documentation. A field you think is optional may be required, and a field you think is a string may be an integer. Copy the schema from the docs, or generate it from a known-good example, rather than guessing.

Second: confusing integer and number. A schema that says integer rejects 36.5, which is correct for a count but wrong for a price. If a field can hold a decimal, the schema must say number, not integer.

Third: forgetting that required only applies to keys that exist in the schema's properties in the usual reading — no, the real trap is the opposite: required lists keys, and a key can be required without having a property schema, which means it must exist but can be any type. Always give required keys a property schema too, or the check is weaker than you think.

Fourth: pattern without anchors. A pattern of [0-9]+ matches any string containing a digit, because the expression is not anchored — "abc123" passes. Anchor patterns with ^ and $ when the whole string must match, such as ^[0-9]+$ for a digits-only field.

A second mistake is writing a schema that is stricter than the data it must accept. A schema that demands an integer will reject 4.5, and a schema that lists an enum of three values will reject a fourth that the API started sending last week. The validator reports those rejections faithfully, which makes it look like the data is wrong when the schema is the thing that is out of date. When a validation fails on data you trust, check the schema first — a schema is a contract, and contracts need updating when the data changes.

How to use this JSON Schema validator

Paste your JSON into the first box and your schema into the second — the defaults are a user record and its schema, with 2 keys and 0 errors. The report updates live in the box below, with the error count and the status above it.

To copy the report, use the Copy button next to the output box. To check a different document, replace the JSON and leave the schema; to check a different contract, replace the schema and leave the JSON. Each error names its path, so fix the named field and validate again.

Everything runs in your browser. No sign-up, no account, no data sent anywhere — your JSON and your schema never leave your device. It works offline once the page has loaded.

Paste the schema first, then the document, and press validate. The result says whether the document is valid, and if it is not, each error names the path and the rule that failed — a path such as $.user.age with the rule minimum tells you the age was below the allowed value. Fix the document or the schema, and validate again; a valid result means the document satisfies every rule in the schema, not just the first one. When the document is valid, copy the verdict into the test or the ticket that asked for it.

Frequently Asked Questions

A JSON validator checks syntax — whether the text parses as JSON. A schema validator checks meaning — whether the parsed JSON matches a schema that describes the expected shape, types, and required fields. Syntax is the first check, schema is the second.

Type, required, properties, enum, minimum, maximum, pattern, minLength, maxLength, minItems, maxItems, and items. It is a mini-validator for everyday checks, not a full implementation of the JSON Schema specification — keywords outside that list are ignored.

Yes. A schema describes what must be true, not what must be absent, so a key the schema does not mention never fails validation on its own. The default schema allows an extra key such as city alongside name and age.

Integer accepts only whole numbers: 36 passes, 36.5 does not. Number accepts any number, including decimals. Use integer for counts and number for prices and measurements.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.