Sketch a JSON Schema from a real payload

Writing a schema by hand means guessing at your own data. Infer a draft 2020-12 schema from the JSON you actually have, then tighten it.

Tools used in this guide

The job

You have a working JSON payload — an API response, a config blob — and need a schema for validation or documentation. The structure already exists; writing it out manually is transcription.

Infer the shape

Paste the sample and generate. Every object gets a properties map, arrays get an items schema merged across their elements, and scalar types are recorded — integers separately from numbers.

  • Format detection optionally marks strings as date-time, date, uuid, email, or uri.
  • required lists only the keys seen in every object of that type.

Worked example

A user record with name, email, an array of two tag strings, and a null middle_name produces properties for each — tags get items.type "string", middle_name gets type "null". Turn format detection on and email earns "format": "email".

Treat it as a draft

Inference sees what exists, not what's allowed: a field that was null in your sample might legitimately be a string, and optional keys only appear if the sample had them. Read the schema as documentation of the sample, then widen types where the real contract is looser.

  • Input up to 500 KB — the sample is parsed, never sent anywhere.
  • Formats are heuristic: a string that looks like an email is marked email even if the API treats it as opaque.