JSON schema validator
Validate JSON data against a JSON Schema to check data types, required fields, formats, and structural rules. Find validation errors and their locations instantly in your browser.
All Developer Tools
Browse free online tools for JSON, HTML, CSS, XML, JavaScript, data conversion, and everyday development tasks.
Try a different search term or select another category.
What Is a JSON Schema Validator?
A JSON Schema validator checks whether a JSON document follows the rules defined in a JSON Schema. Those rules can specify the fields an object must contain, the data type each value must use, the values that are allowed, and the structure required for nested objects and arrays.
A regular JSON validator checks syntax, such as quotation marks, commas, and matching braces. A JSON Schema validator goes further: it checks whether syntactically valid JSON matches an expected data structure. This helps you catch payloads that can be parsed successfully but still do not meet an application's requirements.
Use this online JSON Schema validator by entering your JSON data and its schema, then running validation. Review the result to identify missing properties, type mismatches, invalid formats, disallowed values, or other constraint failures.
Key difference: Valid JSON is not automatically valid against a schema. JSON syntax determines whether the data can be parsed; the schema determines whether that data meets a defined contract.
How to Validate JSON Against a Schema
Follow these steps to check whether a JSON object or array matches your schema.
Paste the JSON payload you want to test into the JSON Data panel. Check that the content is complete and uses valid JSON syntax.
Paste the schema that describes the expected data. Include the relevant property definitions, required fields, data types, and other constraints.
Select Validate to compare the supplied JSON with the schema rules supported by the validator.
If validation fails, use the reported property path and rule to locate the problem. Update the data or schema as appropriate, then validate again.
A useful error message identifies the affected field, the constraint that failed, and the reason for the failure. For example, a message may indicate that /items/0/quantity must be an integer rather than a string.
Example: JSON Data and JSON Schema
In this example, an order payload must contain an order ID, customer email, total amount, currency, and at least one item. Each item must include a SKU and a positive integer quantity.
JSON Data
JSON Schema
The payload matches the main constraints in this schema. If total_amount were written as "42.50", validation would fail because the value would be a string instead of a number. A currency such as "CAD" would also fail the listed enum rule.
Tip: Fix the JSON data when it does not meet the intended contract. Change the schema only when the permitted data structure or business rule itself needs to change.
What Does a JSON Schema Validator Check?
JSON Schema can describe many kinds of restrictions. The exact keywords available depend on the schema draft and validation engine being used.
Types and required fields
Check for strings, numbers, integers, booleans, objects, arrays, and null values. The required keyword identifies properties that must be present.
Allowed properties
Define properties, restrict unexpected fields with additionalProperties, and set limits on how many properties an object can contain.
Lengths and formats
Set minimum or maximum string lengths, apply regular-expression patterns, and declare formats such as email, date-time, or URI where supported.
Ranges and increments
Set minimum and maximum values, exclusive limits, and permitted multiples using numeric constraints such as minimum, maximum, and multipleOf.
Items and uniqueness
Validate array items against a schema and set limits for array length. Depending on the draft, keywords can also check unique items, prefixes, or whether matching items are present.
Enums and constants
Restrict a field to a fixed set of values with enum or require one exact value with const.
Combined schema rules
Keywords such as allOf, anyOf, oneOf, and not describe data that must satisfy combined or alternative schema conditions.
Reusable definitions
References such as $ref can point to reusable schema definitions. Whether local or external references are resolved depends on the implementation.
Not every validator supports every keyword or schema version. For dependable results, confirm that the schema draft and the rules used in your project are supported by the validation engine.
JSON Validator vs. JSON Schema Validator
These tools solve different problems. Use a JSON validator first when you need to confirm that the text follows JSON syntax. Use a JSON Schema validator when you also need to enforce a defined structure and set of constraints.
| Tool | What it checks | Example |
|---|---|---|
| JSON Validator | Syntax, including valid quotes, commas, braces, brackets, and JSON values. | {"name":"Sam",} fails because the object has a trailing comma. |
| JSON Schema Validator | Whether valid JSON matches schema rules for fields, types, formats, allowed values, and structure. | {"age":"30"} is valid JSON but fails if the schema requires age to be an integer. |
Schema validation does not replace syntax validation. The JSON document must be parseable before its content can be checked against a schema.
Common JSON Schema Validation Errors
When a payload fails validation, check the field path and the rule named in the error. The following issues are common when data comes from APIs, forms, webhooks, configuration files, or automated workflows.
| Error | Why it happens | How to fix it |
|---|---|---|
| Missing required property | A property listed in required is absent from the object. |
Add the property or revise the schema if it should be optional. |
| Type mismatch | A value uses the wrong type, such as "42" where a number is expected. |
Provide the intended JSON type instead of changing the value only to look correct. |
| Invalid format | A value does not match a declared format, and the validator checks that format. | Correct the value and verify how the implementation handles the format keyword. |
| Value not allowed | The value is not included in an enum list or does not match a const value. |
Use an allowed value or update the schema when the accepted values have changed. |
| Pattern mismatch | A string does not match the regular expression specified by pattern. |
Check the actual string and confirm that the expression represents the intended rule. |
| Unexpected property | The object contains an extra field while the schema disallows additional properties. | Remove the unapproved field or permit it in the schema if it is valid for the data contract. |
| Array constraint failed | The array violates item-count, uniqueness, or item-schema requirements. | Correct the array contents or revise the corresponding array rule. |
| Invalid JSON syntax | The input cannot be parsed because of malformed punctuation, quotes, or brackets. | Fix the syntax error before running schema validation again. |
Debugging tip: Start with the first reported error and inspect the nearest property or array item. Fixing one parent-level issue can sometimes remove several related validation errors.
When Should You Use a JSON Schema Validator?
Schema validation is useful wherever software depends on data arriving in a predictable format. Checking data at the boundary of a system can reveal contract mismatches before they cause failures deeper in an application.
API request and response testing
Verify that API payloads include required fields and use the data types and values expected by clients or services.
Webhook validation
Check incoming event bodies before using them in business logic, storing records, or triggering downstream actions.
Configuration files
Catch missing settings, incorrect value types, and unsupported properties in application or deployment configuration.
Data pipelines
Identify records that do not meet an expected contract before they enter a database, ETL process, or analytics workflow.
AI-generated JSON
Check model-generated structured output before passing it to another tool or application. Validation confirms schema compliance, not whether every value is factually correct.
Quality assurance and debugging
Reproduce payload failures, verify test fixtures, and locate the exact field that violates an expected data structure.
JSON Schema Draft Compatibility
JSON Schema has evolved through several drafts, including Draft-04, Draft-06, Draft-07, 2019-09, and 2020-12. A schema may declare a draft, and the validator must support the relevant version to interpret its keywords and behavior correctly.
Before validating production payloads, check which drafts your validation engine supports. Pay particular attention when a schema uses newer keywords, conditional rules, array-related features, or references. A result can be unreliable if the schema depends on features that the configured engine does not implement.
Also remember that a declared string format, such as email or date-time, may be treated differently by different implementations. Confirm whether the validator actively checks that format rather than assuming that every format declaration is enforced identically.
Frequently Asked Questions
What is a JSON Schema validator?
A JSON Schema validator checks whether JSON data matches a schema's rules, including required properties, data types, allowed values, formats, and nested structures.
Is JSON Schema validation the same as JSON validation?
No. JSON validation checks syntax. JSON Schema validation checks whether syntactically valid JSON follows a defined structure and its constraints.
Can JSON be valid but fail schema validation?
Yes. A JSON document can have correct syntax but still omit a required field, use the wrong data type, contain an unapproved value, or violate another schema rule.
Can I validate nested objects and arrays?
Yes. JSON Schema can define rules for nested objects, array items, and deeper structures. The validator checks those rules to the extent supported by its schema draft and implementation.
What does the required keyword do?
The required keyword lists object properties that must be present. It does not define their types; use the corresponding property schema to specify valid values.
What is the difference between properties and additionalProperties?
properties defines schemas for named fields. additionalProperties controls how properties not covered by the other applicable property rules are handled.
What is $ref in JSON Schema?
$ref references another schema or reusable definition. Reference resolution depends on the schema draft and validator; some implementations handle only local references unless configured otherwise.
Which JSON Schema drafts are supported?
Common drafts include Draft-04, Draft-06, Draft-07, 2019-09, and 2020-12. The drafts you can use depend on the validation engine configured in the tool.
Does a valid schema guarantee that the data is correct?
No. Validation confirms that data satisfies the defined schema rules. It does not prove that the information is true, current, secure, or logically correct for every business requirement.
Can I validate an API response with JSON Schema?
Yes. Use a schema that describes the expected response, then validate the returned JSON to check required fields, types, values, and structural constraints.
Does JSON Schema validation fix invalid data automatically?
No. Validation reports whether the data meets the schema. You generally need to edit the payload or schema yourself and run the validation again.
Can JSON Schema validate email addresses?
A schema can declare the email format for a string. Whether and how strictly it is checked depends on the capabilities and configuration of the validator.