Schema & Compare · Runs in your browser

JSON Schema Generator

Generate a JSON Schema from a sample document. Types, required fields, nested objects, arrays and common formats are inferred for you.

JSON sample
Drop a file to load it
JSON Schema
Waiting for input

How to use it

  1. Paste a representative JSON sample — the more variety in arrays, the better the schema.
  2. Choose the draft and whether to allow extra properties or detect formats.
  3. Copy or download the schema, then test it with the Schema Validator.

Arrays of objects

Every item in an array is examined. A key present in all items is required; a key only some items have is optional.

Formats

Strings that are always emails, URIs, UUIDs, dates, date-times or IP addresses get a matching “format”. Turn detection off if your sample is too small to be sure.

A starting point

A schema inferred from examples can’t know your business rules. Add enums, minimums, patterns and descriptions afterwards.