JSON Schema Generator
Paste a sample JSON payload and get a draft-07 JSON Schema describing its shape β types, nested objects, arrays and required fields are inferred automatically.
Generate a JSON Schema from a sample
Writing a JSON Schema by hand is precise but slow β you have to enumerate every property, its type, and which fields are required. Paste a real sample instead and this tool infers a complete draft-07 schema: types for each property, nested object schemas, items definitions for arrays, and a required list. Use it as a starting point for validation, then tighten constraints such as formats and ranges by hand.
How to use it
- Paste a JSON object β or an array of objects for better
requireddetection β into the input. - Set the Schema title so the generated schema is self-describing.
- Copy the schema on the right into your validator or API definition.
A worked example
This JSON:
{ "id": 10, "name": "Ada Lovelace", "active": true }produces a schema like:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GeneratedSchema",
"type": "object",
"properties": {
"id": { "type": "number" },
"name": { "type": "string" },
"active": { "type": "boolean" }
},
"required": ["id", "name", "active"]
}When you would reach for it
Adding request validation to an API, documenting the shape of a webhook, or catching malformed data before it reaches your code. To turn the same sample into compile-time types instead, use JSON to TypeScript; to explore the payload first, open it in the JSON editor.
Privacy
Schema inference runs entirely in your browser and works offline once loaded. Your JSON is never uploaded or stored, so it is safe to paste real payloads.
Frequently asked questions
Which draft is produced?
JSON Schema draft-07, the most widely supported version across validators and tooling such as Ajv, jsonschema (Python) and most API frameworks.
How are required fields chosen?
For an object, a property is required if it is present and non-null. For arrays of objects, only properties present in every element are required β so pasting a representative array gives the most accurate required list.
How are arrays described?
Arrays get an items schema inferred from their elements. An array of objects produces an object schema for items; an array of scalars produces a type such as { "type": "string" }. Empty arrays are left permissive since there is nothing to infer.
What about mixed or null values?
A field that holds more than one type across records is described with a type array (for example ["string", "null"]), so the schema still validates every sample you provided.
Can I use this schema to validate data?
Yes. Feed the output to any draft-07 validator to check future payloads, generate forms, or document an API. Review and tighten constraints (formats, min/max, enums) by hand β inference only captures what the sample shows.
Is my JSON uploaded?
No. The schema is generated entirely in your browser β nothing is sent to a server.