JSON to JSON Schema
Turn an example payload into a JSON Schema you can refine and use to validate future documents.
Your data stays on your device
Input — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Output — JSON Schema
- characters
- 0
- lines
- 0
- size
- 0 B
Options
About this tool
A JSON Schema describes the shape data must take: which types are allowed, which properties exist and which are required. Writing one by hand is tedious, so this tool infers a solid first draft from an example document.
Every object contributes its keys as properties and as required entries; arrays are described by the union of their elements, so a mixed array still gets a schema that accepts all of it. Integers and decimals are distinguished. The output targets Draft 2020-12 by default.
How to use this tool
- Paste a representative JSON example, or upload a file.
- Choose the JSON Schema draft you are targeting.
- Press Generate schema.
- Review and tighten the schema — add formats, patterns or descriptions — then copy or download it.
Key features
- Draft 2020-12, 2019-09 and Draft-07 output
- Required keys captured from the example
- Array item schemas merged across all elements
- Integer and number types distinguished
- Optional generated title field
Example
Input — JSON
{"id":1,"name":"Ada","active":true}Output — JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"active": { "type": "boolean" }
},
"required": [ "active", "id", "name" ]
}Good to know
- A schema inferred from one example is a starting point. Formats, enums, ranges and descriptions still need a human.
- Required keys reflect the example you provided; genuinely optional fields must be adjusted by hand.
Frequently asked questions
Which draft should I choose?
Draft 2020-12 is the current version and a good default. Pick 2019-09 or Draft-07 only if your validator requires it.
Are all properties marked required?
Every key present in the example is marked required, because the tool cannot know which are optional. Remove the ones that should be optional.
Is the JSON uploaded?
No. Schema inference happens in your browser.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.