Skip to content
{}

JSON Schema Generator

Generate a JSON Schema (draft 2020-12) from example JSON data.

0 chars | 1 lines
0 chars | 0 lines

Conversion payloads stay in this browser tab and are never placed in page URLs - see how local processing works. Privacy-safe analytics record only the tool, outcome, and a coarse input-size bucket.

How to Generate JSON Schema

Paste representative JSON and convert it. The tool infers object properties, arrays, and primitive types from your sample, marking a field required only when every sampled record contains it.

Specification and Inference Limits

Output targets JSON Schema draft 2020-12 (https://json-schema.org/draft/2020-12/schema). The schema describes the sample you provided: it cannot prove future records conform, nested required lists reflect only the sampled records, and additionalProperties is set to false to surface unexpected keys early.

Other JSON Schema generators compared

Inferring a schema from data is a solved problem in several places. Which one fits depends on where the JSON lives and what happens to the schema next.

InputOutputNote
This pagePaste or open JSON, get a draft 2020-12 schema in the browserNothing to install and nothing uploaded. Infers types and required keys only.
quicktype (CLI and web app)Infers a schema, or types for many languages, from JSON samplesBetter for build pipelines: quicktype --lang schema sample.json
GenSON (Python library)Builds one schema from many documents, adding them one at a timeBetter when the samples are thousands of files or a stream.
Writing it by handExactly the constraints you mean: formats, enums, ranges, patternsStart from a generated draft, then tighten it.

Frequently Asked Questions

Is this a validator?

No. It infers a JSON Schema from sample data. Use the JSON Validator for syntax checks.

How are arrays handled?

Item schemas are merged across every record in the sample array. A property is only marked required when it appears in all records, and mixed item types become a union of types.

Which JSON Schema draft is produced?

The output declares JSON Schema draft 2020-12 via the $schema keyword and uses only core type, properties, items, required, and additionalProperties keywords from that specification.

How do I generate a JSON Schema from several example documents?

Wrap the examples in one JSON array and paste the array. Every element is merged into a single item schema, so a key that is missing from some examples is left out of required, and a key that holds a string in one example and null in another gets the type ["null", "string"]. The more varied the sample, the more honest the schema.

Does it detect integers, formats, or enums?

No. Every number becomes type number, and strings get no format such as date-time or email and no enum, because one sample cannot show that a value is always whole, always a date, or limited to a fixed list. Add integer, format, enum, minimum, or pattern by hand where your data guarantees them.

Can it generate example JSON from a schema?

No. This tool goes from JSON to a schema. To check a document against a schema you already have, use a validator such as Ajv (JavaScript) or the jsonschema package (Python).

Generators workflow

Continue with the data, not the directory

Turn representative JSON into schemas, interfaces, validators, and language types.

Browse generate developer types