Skip to content
Web Codes Stack
Explore Free Tools

JSON Schema Generator

Generate a Draft 2020-12 JSON Schema from an example document, then refine it to match your data contract.

How to use it

  1. Paste a JSON sample with representative objects, arrays and values.
  2. Decide whether to infer required fields from the sample, then select Generate schema.
  3. Review the generated constraints, copy or download the schema, and test it against representative data using a Draft 2020-12 validator.

Practical example

Draft a contract for an inventory record

{
  "sku": "P-104",
  "quantity": 12,
  "warehouses": ["eu-west"]
}

The schema describes an object with a string SKU, an integer quantity and an array of strings. Add any minimum quantity or SKU pattern your application requires.

Frequently asked questions

Which JSON Schema version is used?

The generated schema declares Draft 2020-12.

Should all observed properties be required?

Keep required-field inference off unless your samples represent fields the contract actually requires. Optional fields may appear in a sample.

Can a sample tell me every valid input?

A sample only shows values and shapes that actually occur in it. Review missing variants, optional fields and business constraints against your application.

Related tools

JSON to TypeScript

Turn a JSON sample into TypeScript definitions for objects, arrays and mixed values.

Open tool

JSON Validator

Check JSON syntax and locate parsing errors with clear feedback.

Open tool

JSON Diff Checker

Compare JSON structures and review added, removed or changed values side by side.

Open tool