Overview
Validate JSON against a JSON Schema
JSON Schema is a vocabulary for describing the shape of JSON data: which fields are required, what types they must be, what values are allowed, and how nested objects and arrays should look. A validator checks a piece of data against that schema and reports exactly where and why it does not conform.
ToolHub JSON Schema Validator lets you paste a schema and a JSON document side by side and see instantly whether the data is valid. If it is not, every failing rule is listed with its location and a clear message. Validation runs entirely in your browser using Ajv, so your data and schema never leave your device.
Step-by-step
How to validate JSON data
- 1
Paste your schema
Drop your JSON Schema into the left panel. The sample schema shows required fields, types, and constraints you can adapt. - 2
Paste the data to check
Put the JSON document you want to validate into the right panel. Edit either box and the result updates as you type. - 3
Read the result
A green status means the data is valid. A red status lists each error with the path that failed and what the validator expected.
Background
What JSON Schema validation checks
A schema is itself a JSON object. Common keywords include type to fix the data type, required to list mandatory properties, properties to describe each field,minimum and maximum for numbers, and items to describe array elements. The validator walks your data and confirms every one of these rules holds.
Reading the error path
When data fails, each error reports an instance path that points to the exact location in your document. A path like /age means the age field is the problem, while root means the issue is at the top level, such as a missing required property. The message then tells you what was expected.
A valid schema versus valid data
There are two things to get right. First, the schema must itself be valid: if it has a structural mistake, the validator cannot compile it and says so. Second, the data must satisfy the compiled schema. This tool distinguishes the two cases so you know whether to fix the schema or the data.
Use cases
When to validate JSON
API contract testing
Confirm that a request or response body matches the schema your API documents before shipping a change.
Config file validation
Catch typos and missing keys in JSON configuration before they break an application at startup.
Form and payload checks
Verify that data collected from a form or webhook has the required fields and correct types.
Writing and debugging schemas
Iterate on a schema with real sample data until both passing and failing cases behave as you expect.
Data pipeline gates
Validate records against a schema so malformed entries are caught early instead of corrupting downstream steps.
Documentation examples
Make sure the example payloads in your docs actually satisfy the schema you publish alongside them.
Tips and best practices
- Set additionalProperties to false when you want to reject unexpected fields instead of silently allowing them.
- List every mandatory field in the required array, since properties alone does not make a field required.
- Use minimum, maximum, minLength, and pattern to constrain values, not just their types.
- Validate both a passing and a failing example so you know the schema rejects bad data, not just accepts good data.
- If the validator reports a schema error, fix the schema first, then re-check your data.
Common questions
What is the difference between a schema error and an invalid result?
A schema error means the schema itself could not be compiled, so it is broken or malformed. An invalid result means the schema is fine but the data does not satisfy it. The tool tells you which one you are looking at.
Why does it say root in an error?
Errors at the top level of your document, such as a missing required property, have no deeper path to point to, so they are reported at root. Errors inside the data show a path like /items/0/name instead.
Does it show every error at once?
Yes. The validator collects all failures rather than stopping at the first one, so you can fix everything in a single pass instead of re-running after each change.
Is my data sent anywhere?
No. Both the schema and the data are parsed and validated in your browser. Nothing is uploaded, so it is safe to validate sensitive payloads.
100% private