How it works
- Paste a real JSON sample (one object or an array of them), or describe the fields in plain English.
- Pick the schema version and whether unknown fields should be rejected, add any rules such as allowed values or ranges, and click Generate schema.
- Copy the schema into your validator (Ajv, jsonschema, your API gateway) and read the notes: they list every guess, such as a nullable field or a pattern inferred from one example.
Examples
Sample results for the inputs shown, so you can see the format and quality before you try it.
Sample JSON or a description: { "id": "7f3c2a9e-1b4d-4c8a-9e2f-3a5b6c7d8e9f", "email": "[email protected]", "name": "Ana Ruiz", "age": 34, "roles": [ "admin", "editor" ], "created_at": "2026-03-14T09:30:00Z", "address": { "city": "Madrid", "postal_code": "28013" }, "newsletter": true }
Schema version: Draft 2020-12
Strictness: Strict (reject unknown fields)
Sample JSON or a description: Webhook payload for a new order: order_id (string), total in cents (integer, 0 or more), currency (USD, EUR or GBP), items (at least one; each has sku, quantity of 1 or more, unit_price_cents), optional coupon code, customer email.
Schema version: Draft-07
Strictness: Lenient (allow extra fields)
Sample JSON or a description: { "sku": "TSHIRT-BLK-M", "title": "Black T-shirt", "price": 19.99, "discount_price": null, "tags": [ "cotton", "basics" ], "stock": { "warehouse_a": 12, "warehouse_b": 0 } }
Schema version: Draft 2020-12
Strictness: Lenient (allow extra fields)
Tips for better results
- Paste two or three real records instead of one. Fields that are null or missing in some records tell the generator what is optional.
- Put business rules in the Extra rules box. A sample can't tell it that status only takes three values or that price is never negative.
- Choose Strict for data you accept from outside (webhooks, public APIs) and Lenient for data you consume from others, so their new fields don't break you.
- Turn on format checking in your validator if emails and dates matter. In Ajv that means adding ajv-formats; without it, format is not enforced.
FAQ
Is this JSON Schema generator free?
Yes. Enter your email once to use it (you'll also get Something Big, our free weekly AI newsletter, and you can unsubscribe anytime). There's no account and no credit card.
Which JSON Schema versions does it support?
Draft 2020-12, Draft 2019-09 and Draft-07. It sets the matching $schema URL and uses $defs or definitions to suit the version.
How does it decide which fields are required?
In Strict mode every field in your sample is required and unknown fields are rejected. In Lenient mode only the obvious essentials are required. Either way, the notes list the choices so you can adjust them.
Is the schema guaranteed to validate my data?
Run it against a few real records before you rely on it. The generator checks its own JSON and lists its assumptions, but it has not seen your full dataset.
More free AI tools
Related prompts
Prefer to use ChatGPT or Claude directly? These free prompts do similar jobs.