Toolvist

JSON Schema Generator

Analyse a JSON sample and generate a JSON Schema describing its structure and types. Free online schema generator with draft-07 output to copy.

Paste JSON to analyse.

Ready.

Root type

—

Properties

0

Max depth

0

Formats detected

0

JSON Schema Generator

Paste a sample JSON document and get a JSON Schema that describes it. Array items are merged so a schema built from a list of records captures every field, and common string formats like dates, emails and UUIDs are detected automatically.

The generated schema documents what the JSON Validator checks, and the data itself is made readable by the JSON Formatter & Beautifier. For the shape of an API response rather than a document, the GraphQL Formatter is the neighbour.

How to use the JSON Schema

  1. 1 Paste a JSON document or an example response.
  2. 2 Choose whether to infer types strictly or permissively.
  3. 3 Generate. The schema describes the structure with required fields and types.
  4. 4 Copy the schema and refine it — inference from one example is a starting point.

Schema as documentation

The practical value of a schema is that it is machine-readable. Documentation in prose drifts from the implementation and cannot be enforced; a schema can be run against real payloads in a test, which means a breaking change to an API surfaces as a failing test rather than as a support ticket.

Generating from an example is the fastest way to start, but it should be treated as a first draft. Tightening the inferred types, adding constraints and marking the genuinely required fields is where the schema acquires value.

  • `required` lists the fields that must be present.
  • Nullable fields need both a type and a null allowance.
  • Inference from one sample cannot determine required fields.
  • Draft version affects which keywords are valid.

How It Works

The generator walks your sample recursively. For arrays of objects it merges the schemas of every item, so fields that appear in only some records are still represented and required keys are the ones present in all of them.

  • Draft-07 and 2020-12 output
  • Merges array item schemas
  • Required keys inferred across records
  • String format detection (date, email, URI, UUID)
  • Enum detection for small value sets

Frequently asked questions

What is a JSON Schema for?

For describing and validating the shape of JSON documents. It states which fields exist, which are required, what types they hold, and the constraints on their values. It is used to validate API payloads, generate documentation, and produce typed code from the structure.

Why is a single example not enough?

Because it cannot distinguish required from optional fields. A field present in the example might be present in every valid document or might be one of many optional ones, and nothing in one sample tells you which. Fields that happen to be null in the example are similarly ambiguous.

Which draft version should I target?

Whichever the consuming tool supports. The specification has evolved and later drafts changed keywords, so a schema written for a newer draft may not validate correctly against an older validator. Recent drafts are the safer default unless a tool requires otherwise.

Related Developer Tools

Browse all Developer Tools →

You might also need

Tools from other categories that people pair with the JSON Schema:

Browse the full tool directory →