Developer · Free Tool
JSON Schema Generator
Turn a sample JSON object into a JSON Schema for API validation or LLM structured outputs, with required fields, strict mode, and format detection.
For LLM structured outputs (OpenAI strict mode, Claude strict tool use), keep "required" and "no extra properties" on: strict modes expect every property listed as required and no unknown keys. Optional fields then come out as a type that allows null.
About this tool
Paste an example of the JSON you expect and get a JSON Schema describing it: types for every field, nested objects and arrays, required properties, and detected formats such as date-time, email, and URL. Arrays of objects are merged, so a field present in only some items is marked optional and a field that is sometimes null becomes nullable.
The defaults suit LLM structured outputs. OpenAI's strict mode and Claude's strict tool use expect every property to be listed as required and no extra properties to be allowed, so optional fields are expressed as nullable instead. Turn those options off for a looser schema for ordinary API validation.
Common uses
- Write the schema for an LLM tool or structured output from an example of the result you want
- Validate webhook or API payloads in n8n, a backend, or a test suite
- Document the shape of an API response for a team or a client
Frequently asked questions
Why are optional fields marked as nullable instead of left out of required?
Strict structured-output modes require every property to be listed as required. The way to express "this may be missing" is to let it be null, so the model returns null instead of omitting the key. Untick "No extra properties" to get the classic optional-field style.
Which JSON Schema draft should I choose?
2020-12 is the current standard and what most modern validators and LLM APIs accept. Choose draft-07 for older tools such as some versions of Ajv configurations or OpenAPI 3.0 workflows.
How accurate is a schema inferred from one example?
It reflects only what the sample shows. Paste a richer example (an array with several varied records works well) and review the result: add enums, minimums, or descriptions where your data has rules a sample cannot reveal.
Is my data uploaded to a server?
No. This tool runs entirely in your browser using JavaScript, so nothing you type is transmitted, logged, or stored anywhere. You can even use it offline once the page has loaded.