JSON Schema validator
What is a Json Schema Validator?
JSON Schema describes the expected shape of JSON data: which properties are required, what type each one has, allowed values and ranges. Validating against a schema catches bad data early, before it reaches your database or breaks a client. This validator checks a JSON document against a schema and lists every error with its location.
How to use it
- Paste the JSON Schema.
- Paste the JSON data to validate.
- Read the result and the list of errors, if any.
Supported keywords
This tool covers a practical subset of JSON Schema: type, required, properties, items, enum, minimum and maximum, minLength and maxLength, and pattern. Advanced features such as $ref, oneOf and allOf need a full validator library like Ajv.
Example
Schema (double quotes in real JSON):
{
'type': 'object',
'required': ['email', 'age'],
'properties': {
'email': { 'type': 'string', 'pattern': '^.+@.+$' },
'age': { 'type': 'integer', 'minimum': 18 }
}
}Data { 'email': 'asha.example.com', 'age': 16 } produces two errors: email does not match the pattern, and age is below the minimum of 18.
Where JSON Schema is used
- Validating API request bodies, for example in Fastify or with OpenAPI specifications.
- Editor autocompletion and validation for config files such as
package.jsonand GitHub Actions workflows. - Form generation and data contracts between teams.
Tips
- Add
additionalProperties: falsein a full validator to reject unexpected fields. integerrejects 16.5;numberaccepts it.
Frequently Asked Questions
What is JSON Schema?
A JSON-based vocabulary that describes the structure, types and constraints that JSON data must follow.
Which JSON Schema keywords are supported here?
type, required, properties, items, enum, minimum, maximum, minLength, maxLength and pattern.
What is the difference between integer and number?
integer only accepts whole numbers, while number also accepts decimals.
Which library should I use in code?
Ajv is the most widely used validator for JavaScript, and jsonschema is popular in Python.