data

JSON Schema Generator

Generate JSON Schema from sample JSON and validate data locally with Draft 2020-12 or Draft 7.

JSON Schema Course

Learn how JSON Schema describes data contracts, validates payloads, and evolves with APIs and configuration files.

Course home

About this tool

DevCove JSON Schema Generator turns sample JSON into a practical schema starting point, then validates another JSON document against the schema in the same workspace. Use it for API responses, mock data, fixtures, configuration files, and documentation drafts. Generation and validation run locally in your browser.

How to use this tool

Use this tool when you have a real JSON example and need a schema for API validation, mock data, or documentation.

  1. Paste a representative JSON object or array into Sample JSON, or keep the loaded API response example.
  2. Choose Draft 2020-12 for new projects, or Draft 7 when an existing validator or platform still expects the older schema version.
  3. Choose Strict required fields when the sample should define mandatory properties. Choose Flexible when you want a looser starting point.
  4. Keep Infer string formats enabled to detect common strings such as email, URI, UUID, date, and date-time.
  5. Click Generate schema and review the generated JSON Schema before treating it as a contract.
  6. Paste another JSON document in Validation JSON and click Validate data to check it against the generated schema.
  7. Copy or download the schema once it matches your API, fixture, or documentation needs.

Features

Built as a standalone schema workspace, separate from the JSON Formatter, for teams that need a reusable validation contract:

  • Generates JSON Schema from objects, arrays, nested objects, arrays of objects, primitives, and null values.
  • Defaults to JSON Schema Draft 2020-12, with Draft 7 available for older validators.
  • Strict and Flexible required-field modes to control how strongly the sample shapes the schema.
  • Array item merging so optional fields in sample rows are not marked required unless every row includes them.
  • Nullable field inference when samples mix null with concrete values.
  • Optional format inference for email, URI, UUID, date, and date-time strings.
  • Local Ajv validation against the generated or pasted schema.
  • Readable validation errors with instance paths, keywords, and parameters.
  • Copy and download actions for generated schema files.
  • 100% browser-side processing: samples, schemas, and validation data are not uploaded.

FAQ

What is JSON Schema?

JSON Schema is a vocabulary for describing the shape of JSON data: object properties, required fields, value types, arrays, formats, and constraints. Developers use it for API validation, documentation, mocks, and tests.

What does Draft 2020-12 mean?

It is a version of the JSON Schema specification. Draft 2020-12 is a modern default for new work, while Draft 7 remains common in older tools and platforms. This generator lets you choose either.

Is the generated schema final?

Treat it as a strong starting point, not an automatic contract. Review required fields, add business rules such as minimum lengths or enum values, and adjust anything the sample cannot prove.

How does Strict required mode work?

Strict mode marks object properties as required when they appear in every sampled object at that level. In arrays of objects, a property missing from one row is not marked required.

When should I use Flexible mode?

Use Flexible mode when your sample is incomplete, when API fields are often optional, or when you want a permissive schema before tightening rules manually.

Does this validate JSON Schema formats such as email or URI?

Yes. When format inference is enabled, the tool can add and validate common formats including email, URI, UUID, date, and date-time.

Is my JSON uploaded?

No. Schema generation and validation run in your browser using local JavaScript and Ajv. DevCove does not upload or store your sample, schema, or validation data.