Skip to content
Aarrange

JSON Schema Validator

Paste JSON and a schema. See every mismatch on its line. Nothing leaves your browser.

0
Keys
0
Schema keys
0
Errors
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try , or .
On this page

About JSON Schema Validator

Updated

What is a JSON Schema Validator?

A JSON Schema Validator checks whether a JSON document follows a JSON Schema. Paste your data in the Data tab and your schema in the Schema tab. The tool checks as you type and rings the exact place in the data that does not match, with the reason.

How to use this tool

Switch between the Data and Schema tabs at the top of the Input pane. Each tab keeps its own text and its own undo. When the data does not match, the Result pane names the first problem, rings it in the data, and lists the next ones. Errors in the schema itself are ringed in the Schema tab.

Generate a schema from JSON

No schema yet? Press Generate schema to create one from your data. The generator finds the types, detects formats (email, date, URI), marks keys as required, and handles nested objects and arrays. Then add rules such as minimum, pattern or enum.

Generate sample data from a schema

Have a schema but need test data? Press Generate sample to fill the Data tab with JSON that follows the schema. It uses examples, defaults and enums from the schema where it can. This is useful for API tests, mock data and documentation.

Customization

Open Options to turn format checks on or off, to report unknown keywords in strict mode, and to choose the draft for generated schemas. The tool remembers your choices.

About JSON Schema

JSON Schema is a vocabulary to describe and check JSON documents. It says which keys are required, which types and formats values must have, and how parts relate to each other. It is used for API validation, for checking configuration files, and as a contract for data exchange.

Schema draft versions

JSON Schema has evolved through several drafts. The most common are Draft-07 (2018, widely used) and Draft 2020-12 (the latest, which adds prefixItems and $dynamicRef). This tool reads the draft from the $schema keyword.

Common use cases

  • Checking API request and response bodies against an OpenAPI schema.
  • Checking that configuration files, such as package.json or tsconfig.json, have the expected structure.
  • Generating TypeScript types from JSON Schema.
  • Creating form validation rules from a schema.
  • Documenting data contracts between services.

Key features

JSON Schema supports type checks (string, number, integer, object, array, boolean, null), required keys, string formats, regular expression patterns, number ranges, array lengths, combinations (allOf, anyOf, oneOf), conditions (if, then, else) and reusable definitions with $ref.

Powered by Ajv

This tool uses Ajv, a fast JSON Schema validator for JavaScript that is used by webpack, ESLint and thousands of other tools, with format checks from the ajv-formats plugin.

Other JSON Schema resources

JSON Schema Validator FAQ

Which JSON Schema draft versions are supported?

Draft-07, Draft 2019-09 and Draft 2020-12. The tool reads the draft from the $schema keyword in your schema; without it, Draft-07 is used. It uses Ajv, the most widely used JSON Schema validator for JavaScript.

What formats are checked?

With the ajv-formats plugin, the tool checks string formats such as email, date, date-time, time, uri, uri-reference, ipv4, ipv6, uuid and regex. You can turn format checks off in Options.

Can I use this for OpenAPI or Swagger schemas?

Yes. OpenAPI 3.0 uses a subset of JSON Schema for request and response bodies, and OpenAPI 3.1 uses JSON Schema 2020-12. Paste a schema from your OpenAPI file and check sample payloads against it. Some OpenAPI 3.0 keywords, such as nullable, must be rewritten as standard JSON Schema first.

Does it support $ref references?

Yes, references inside the same schema, including $defs (2019-09 and later) and definitions (Draft-07). External $ref URLs are not loaded, so nothing leaves your browser.

Is the schema itself checked?

Yes. Before checking your data, the tool checks the schema against the rules of its draft. A wrong keyword value, such as "type": "text", is ringed in the Schema tab.