JSON to JSON Schema Generator
Example
Input:
{"name": "Ali", "age": 30}Output:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
},
"required": [
"name",
"age"
]
}About this converter
A schema inferred from one sample is a starting point with known blind spots, and this generator is honest about them: every key present becomes required (a second sample might prove some optional), numbers become integer or number by the sample's shape, and no constraints (minLength, pattern, enum) can be inferred from a single value. What you get is the structural skeleton — types, nesting, array item shapes — which is 90% of the typing when documenting an API or setting up validation, ready for you to relax required lists and add the constraints only a human knows.
Frequently Asked Questions
Why is every property required?
Inference from one sample cannot know a key is optional. Feed an array of varied samples to tools that merge, or trim the required list by hand.
Which draft is generated?
JSON Schema 2020-12, the current release; the structure is also compatible with draft-07 consumers for these basic keywords.