Formatter Validator Minifier Escape / Unescape JSON ↔ String JSON ↔ YAML JSON → CSV NDJSON / JSON Lines JSON → Types JSON ↔ XML JSON Diff JSON Patch Canonicalize (RFC 8785) Schema Validator Schema Generator JSONPath Tester JWT Decoder JSON Errors Schemas More Tools
● INFERRED, THEN VERIFIED · 100% BROWSER-BASED

JSON Schema Generator

Paste a sample and get a JSON Schema for draft-07 or 2020-12. Every schema is then validated against the samples it came from, and everything the tool had to guess is listed rather than hidden — because a schema is a contract and a sample is one thing that happened.

Draft
Sample JSON
JSON Schema
Schema will appear here

One sample cannot tell you what is optional

From a single document, every key it contains looks required and every key it lacks does not exist. That is not a schema, it is a description of one record. Paste an array of samples or an NDJSON file and the inference has something to work with: a key present in every sample is marked required, a key present in some is not, and a field that is sometimes null gets a nullable type.

The tool detects which you have pasted. A single object is one sample; an array of objects is treated as many; a file with one JSON value per line is read as NDJSON.

The schema is checked against its own samples

A generator that emits a schema its own sample fails is worse than useless, and it is the one claim here that can be tested rather than asserted. So every schema is run against the documents it was derived from, using the same engine that scores 904/906 on the official draft-07 suite and 1221/1226 on 2020-12. The result is shown above the output, every time.

If you want to check the schema against other documents — which is the real test — use Open in validator to carry both across to the schema validator, which also reports keywords that were present but never applied.

And how confident each guess is

format

Applied only when every value in a field matches one pattern: date-time, date, time, uuid, email, ipv4, ipv6, uri. Anything ambiguous is left off, because a wrong format assertion is worse than none.

enum

Only with real evidence: a small number of distinct values, seen across at least six samples, each repeating. Three sightings of two country codes is not an enum, and is not treated as one.

integer against number

integer only when every value is whole. A field holding 8 and 9.5 becomes number, not a union — JSON Schema's number already includes integers.

Mixed types

A field holding a string in one sample and a number in another is reported. The schema allows both, but this is nearly always a modelling problem worth fixing at the source rather than encoding.

Empty arrays

An array that was empty in every sample says nothing about its elements, so the schema allows anything inside it and the tool tells you which fields those were.

What it will not invent

No minLength, minimum or pattern unless you ask. Bounds taken from a sample are a description of that sample, not a rule — turn them on deliberately and review them.

Which draft to choose

2020-12 is the current release and the default. draft-07 remains the most widely implemented in existing tooling, so choose it when the schema has to be consumed by something you do not control. The two differ in more than the $schema URI — most visibly in how arrays and $ref behave — and the schema registry documents where real schemas trip over the difference.

Where to go next