JSON Schema Generator
Turn a sample payload into a JSON Schema you can validate against.
Everything runs inside your browser. Your files never leave your device.
Input
Result
Ask about JSON Schema Generator
Questions about what this tool does, which option to pick, or what it can and cannot handle.
The question you type here is sent to an AI provider to be answered — your files and whatever you put in the tool above are not, and the assistant cannot see them. Answers are generated and can be wrong. The tool itself is not guessing: it runs deterministic code on your device.
About the JSON Schema Generator
A JSON Schema describes the shape a document must have, so a validator can check payloads automatically instead of a person reading them. Writing one by hand from an existing API response is tedious and error-prone; this generates a first draft from the response itself.
Paste a sample and it infers types, walks nested objects and arrays, and emits a schema in draft 2020-12 or draft-07. Optionally it detects formats in string values — dates, date-times, email addresses, URLs, UUIDs and IPv4 addresses all get a format annotation, which turns a plain string field into one a validator can actually check.
Arrays get particular care. Real payloads are rarely uniform: one element has a null where the next has a string, one object carries an extra field. Rather than describing only the first element, the generator merges the schemas of all of them, widening a type into a union where they disagree. It also narrows the required list to the keys present in every element, since a key missing from one is by definition not required.
That is the one place where the output needs your judgement rather than your trust, and the page says so under every result. A schema inferred from one sample describes that sample. If a field is nullable but happened to have a value in your example, the schema will say it cannot be null and your validator will start rejecting perfectly legitimate responses. Read the required list and the types before putting this in a pipeline.
By default every object also gets additionalProperties set to false, which is strict on purpose: it fails loudly when an API starts sending something new, rather than silently ignoring it. Relax it if your consumers should tolerate unknown fields.
How to use it
- 1Paste a representative JSON payload — ideally a real response rather than a hand-written example.
- 2Choose the draft. 2020-12 is current; draft-07 has the widest support among older validators.
- 3Leave format detection on so dates, emails and UUIDs are annotated rather than left as plain strings.
- 4Read the required list and relax anything that is genuinely optional before you use the schema to validate live traffic.
Questions
- Which draft should I choose?
- 2020-12 for anything new. Choose draft-07 if your validator library is older, which many still are — it remains the most widely implemented version by some distance.
- Why is every field marked required?
- Because a sample proves a key exists and never proves one may be absent. The generator cannot know which fields are optional, so it starts strict and leaves the loosening to you. Switch the option off if that is the wrong default for your payload.
- How does it handle arrays where the elements differ?
- It merges every element's schema rather than describing the first one. Where types disagree it produces a union, and it marks a key required only if it appears in every element.
- Can I generate a schema from several samples at once?
- Put them in an array and paste that. The merging logic applied to array elements is exactly what you want across examples, and the schema you need is then the one under “items”.

