Lintify Logo
Lintify
Schema & Query

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.

Sample JSON
1
JSON Schema
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.

How does Lintify infer types?
Lintify walks your document recursively and assigns a type to every value based on what JavaScript sees — object, array, string, number, boolean, or null. For arrays, it merges the shapes of every element so that a list of similar objects produces a single item schema rather than one per index.
Should every property be required?
That depends on your use case. Strict APIs usually mark every field required so that consumers cannot silently drop properties. Event payloads and configuration files usually leave fields optional so new versions can add them without breaking older clients. Lintify gives you a toggle for both modes.
Can the generator detect string formats like email or date?
It does a best-effort pass for a small set of common formats — ISO 8601 date strings, RFC 3339 date-times, URLs, email addresses, UUIDs, and IPv4 addresses. The detection is heuristic and you should review the results before relying on them in production.
Why are my array elements merged into one shape?
If every element of an array has the same shape, merging them produces a clean schema with a single items definition. If the elements differ, the merge falls back to a permissive type. For arrays that mix genuinely different shapes, consider using anyOf explicitly in the generated schema.
What draft should I generate for?
Draft 2020-12 is the current standard and is recommended for new schemas. Draft-07 is still widely supported and a safe default if you are not sure what your validators can handle. Pick draft-04 only if you are stuck on a very old runtime that cannot be upgraded.

Related tools