DEVELOPER & DATA

JSON Schema Generator

Infer a JSON Schema (draft 2020-12 or 7) from a sample: types, nested objects, array items merged across elements, nullable unions, formats, required keys.

A schema with type, properties, required, items and additionalProperties as the sample shows them, formats where a string looks like a date, e-mail, URI or UUID, and notes on what a single sample cannot prove.

Example: {"id":1,"email":"a@b.co","tags":["x"],"items":[{"a":1,"b":"s"},{"a":2}]} → id integer, email string with format email, tags array of string, items with a required and b optional.

v0.1.0 · last reviewed 22 September 2026
Loading the workspace…
BUILT TO BE UNDERSTOOD

What the sample shows,
and only that.

How types are inferred, how array items are merged, and why the required list needs your judgement.

Inference

Each value is typed: integer or number, string (with a format when it looks like a date, date-time, time, e-mail, UUID, URI or IPv4 and format detection is on), boolean, null, object (with properties) or array. Objects get additionalProperties: false unless you allow more, and — when the option is on — a required list of every key present. Nested objects are recursed.

Arrays

The schema of every array element is merged: identical shapes collapse, objects merge their properties with required reduced to the keys present in every element, integer with number becomes number, a type with null becomes a type list, and anything else becomes anyOf. So [{a, b}, {a}] yields a required and b optional, which is the one thing a sample can say about optionality.

What it cannot know

A single document shows what is there, not what is allowed: no enum, minimum, maxLength or pattern is invented, and a key present once is not proof it is always present. Treat the output as a draft — trim required, add constraints and descriptions — and check it against more documents with the JSON Schema Validator. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.

SOURCES

  • JSON Schema 2020-12 and draft-07 vocabularies: type, properties, required, items, additionalProperties, format, examples; merging of array element schemas into type lists or anyOf

Last reviewed 22 September 2026. How results are checked: How we verify.