JSON Schema Generator
Generate a JSON Schema (draft 2020-12) from example JSON data.
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. Press Cmd/Ctrl + Enter to convert.
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.
| Input | Output | Note |
|---|---|---|
| This page | Paste or open JSON, get a draft 2020-12 schema in the browser | Nothing 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 samples | Better for build pipelines: quicktype --lang schema sample.json |
| GenSON (Python library) | Builds one schema from many documents, adding them one at a time | Better when the samples are thousands of files or a stream. |
| Writing it by hand | Exactly the constraints you mean: formats, enums, ranges, patterns | Start 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).
Continue with the data, not the directory
Turn representative JSON into schemas, interfaces, validators, and language types.
JSON Validator
Check whether JSON is valid, with any error highlighted at its exact line and column, a plain explanation, and one-click repair.
JSON to TypeScript
Generate TypeScript interfaces from sample JSON.
JSON to Pydantic Model
Generate Python Pydantic models from sample JSON instantly.
JSON to Go Struct
Generate Go structs with json tags from sample JSON instantly.