JSON Schema Generator
Generate a JSON Schema from your sample JSON document. Pick the draft version, decide whether to require every field, and download the result.
Output will appear here…Bootstrap a schema from a real example
Writing a JSON Schema by hand is tedious. You have to enumerate every property, decide on types, mark which fields are required, and handle the awkward cases like nullable fields and arrays of mixed shapes. The schema generator does the boring part for you: paste a sample JSON document, and the generator walks the structure recursively to produce a schema that describes it. You then review and refine the result.
The generator infers types from values: strings, numbers, booleans, null, arrays, and objects. For arrays, it merges the shapes of every element so that a list of similar objects produces a single items definition rather than one per index. Pick whether every field should be marked required (the right default for strict APIs) or optional (the right default for config files and event payloads).
Best-effort format detection
JSON Schema supports a format keyword for common string types like email, uri,uuid, date, anddate-time. The generator does a heuristic pass to detect these formats — ISO 8601 date strings are recognized asdate or date-time, RFC 3339 timestamps as date-time, URLs as uri, and so on. The detection is conservative: if a string does not look like any of the known formats, no format keyword is emitted. Review the results before relying on them.
Which draft to generate for
Draft 2020-12 is the current standard and is recommended for new schemas. Draft-07 is still widely supported and is a safe default if you are not sure what your validators can handle. Draft-04 is supported only for legacy codebases — the vocabulary changed significantly between draft-04 and draft-06, and some validators no longer accept draft-04 schemas.
Limitations of inference
A schema generated from a single sample describes that sample, not the full range of valid data. If your sample happens to have a string field that is always a number, the generator will infer type: "string" when the real schema should allow both. Always review the generated schema against your real data before publishing it. The schema generator is a starting point, not a final answer.
Frequently asked questions
Common questions about the Schema Generator tool.