JSON Schema Generator
Generate a formal JSON Schema draft from your raw data structure
Get a first-draft schema from a sample object
Writing a JSON Schema by hand means listing every property, nesting objects inside objects and remembering the right type names. This generator does the repetitive part. You paste one example of your data and it produces a draft-07 schema that describes the same shape. It is best treated as a starting point that you refine, not a finished contract.
Generating a schema
- Paste a JSON object into the Sample JSON box. Load Complex Sample fills in a product record with strings, numbers, a list and a nested object if you want to experiment.
- Click Build Schema.
- Review the JSON Schema panel. It begins with a $schema line pointing to draft-07, a generic title of Generated Schema and a type of object.
- Press Copy Schema and paste it into your validator, API spec or documentation. Clear resets the box.
What the output contains
- A properties section with one entry per key, typed as string, number, boolean or object based on the sample value.
- Nested objects, which get their own properties section, so the structure mirrors your input.
- Arrays, described with an items type taken from the first element of the array.
- A required list at the top level containing every key present in your sample.
Limits you should plan around
The generator is deliberately simple, so a few behaviors matter in practice. Integers and decimals both come out as number rather than integer. The required list applies only to top-level keys, and nested objects do not receive one. For arrays, only the first item is inspected, so a list of mixed types or an empty list will not be described accurately, and an array of objects is reported with an items type of object without listing that object's fields. A null value is typed as object, which is rarely what you want. There are also no formats, patterns, minimum values or descriptions; you would add those yourself. Because the required list includes everything in the sample, optional fields will need to be removed from it manually.
Where it saves time
- Bootstrapping a schema for a new API endpoint from a real example response.
- Creating a validation skeleton for configuration files that users will edit.
- Documenting the shape of a data export for a teammate who has never seen it.
- Comparing a sample against an existing schema to spot fields that were added later.
Give the tool an object at the top level for the best result. Everything is calculated in your browser with JavaScript, and if the pasted text is not valid JSON, an error dialog appears with the parser message instead of a schema.
Related Tools