JSON Schema Generator

Infer a Draft 2020-12 or draft-07 JSON Schema from sample JSON, with formats.

About this tool

Paste an example API response, config file or record. The schema is generated as you type: types for every field (integer and number told apart), nested objects, array items merged into one shape, required keys and formats for dates, date-times, emails, URLs, UUIDs and IPv4 addresses. Choose the draft, lock objects with additionalProperties: false, add examples, then copy or download.

From one example to a contract

JSON Schema is the standard way to describe the shape of JSON โ€” which keys exist, their types, which are required โ€” so it can be validated in code, documented in OpenAPI, used for form generation, or given to an LLM as a structured-output format. Writing it by hand is tedious and error-prone; inferring it from a real sample gets you 90% of the way. The useful details: arrays of objects are merged so a key becomes required only if every item has it, mixed types become a union (["string", "null"]), integers widen to number when both appear, and strings that look like ISO 8601 dates or emails get a format keyword. The limit is inherent: a schema inferred from one sample knows only that sample. Paste an array of several representative records, then tighten by hand โ€” enums for fixed values, minimum and maximum for numbers, patterns for IDs, descriptions for documentation. The JSON formatter validates syntax first, JSON to TypeScript produces interfaces from the same input, YAML to JSON converts configs, and What YAML is, the syntax that bites, and when JSON is the better choice compares the formats.

Frequently asked questions

Which JSON Schema draft should I use?

Draft 2020-12 is current and used by OpenAPI 3.1. Choose draft-07 for older validators and tools that don't support 2020-12 yet.

How are arrays with different objects handled?

Item schemas are merged: properties from every item are included, a key is marked required only if all items have it, and differing types become a list of types.

Can it detect dates and emails?

Yes โ€” with format detection on, strings matching ISO dates, date-times, emails, http(s) URLs, UUIDs and IPv4 addresses get the corresponding format keyword.

Is my JSON uploaded?

No. The schema is inferred in your browser and nothing is sent anywhere.