JSON Schema Generator
Infer a JSON Schema (draft-07) from a sample JSON document.
This tool needs JavaScript enabled to run in your browser.
What this tool does
This tool looks at a sample JSON value and writes a JSON Schema (draft-07) that describes its shape: the types of each field, the properties of objects and the items of arrays. It gives you a schema to start from, which you then refine by hand.
Strict or loose
With strict on, every property that appears in the sample is marked required and extra properties are forbidden. That is a good default when the sample is complete and you want to catch anything unexpected. Turn it off for a looser schema that only describes types and lets other properties through.
What inference can and cannot do
Inference works from one example, so it sees types, not intent. It cannot know that a string is really an email, that a number has a maximum, or that a field is optional unless your sample shows it missing. Treat the output as a first draft: add formats, bounds, descriptions and enums, and relax required where fields are genuinely optional. When an array holds objects of different shapes, the tool merges them and marks only the common properties required.
Common use cases
- Bootstrapping a schema for an API response you already have.
- Documenting the shape of a config or payload.
- Creating a schema to validate against with the JSON Schema Validator.
Frequently asked questions
- What does strict mode do?
- It marks every property in the sample as required and forbids extra properties. Turn it off for a looser schema that only describes types.
- Is the schema complete?
- It is a first draft inferred from one sample. Add formats, bounds, enums and descriptions, and relax required where fields are optional.
Learning resources
Testsmith also runs hands-on courses and a free practice app for the skills behind this tool.