How to use JSON Schema Generator
- Paste a representative JSON sample — ideally several records in an array.
- Set a title and toggle format detection, required marking, examples or strict objects.
- Copy the generated schema and refine descriptions or enums by hand.
JSON Schema Generator features
- Infers draft 2020-12 schemas from a single object or an array of samples
- Merges array items: shared properties become required, mixed types become type arrays or anyOf
- Detects email, date-time, date, time, uuid, uri, hostname, ipv4 and ipv6 formats
- Optional examples, schema title and additionalProperties: false
- Distinguishes integer from number
- Generates live as you edit the sample
JSON Schema Generator example
Infer a schema from a record
Input:
{"id":"6f1a2c3e-8b4d-4e5f-9a6b-7c8d9e0f1a2b","email":"omar@example.com","age":34}Output:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": { "type": "string", "format": "uuid" },
"email": { "type": "string", "format": "email" },
"age": { "type": "integer" }
},
"required": ["id", "email", "age"]
}Frequently asked questions about JSON Schema Generator
How are "required" properties decided?
When the sample is an array of objects, a property is marked required only if it appears in every item. For a single object, all of its properties are required. You can turn this off.
Which formats are detected?
email, date-time, date, time, uuid, uri, hostname, ipv4 and ipv6. Detection is heuristic — review the result before publishing the schema.
How are mixed types handled?
If array items or property values have different types, the generator emits a type array (e.g. ["integer", "string"]) or an anyOf with the merged object schemas.
Is the output a complete schema?
It is a solid starting point that includes $schema, types, nested objects, array item schemas and required lists. Add descriptions, enums and numeric limits by hand where your contract needs them.