JSON Schema Generator
Generates example JSON Schema definitions for validating and documenting JSON data
Generated 170 words · 1,866 characters
See 3 examples
- Example 1
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/schemas/event.schema.json", "title": "Event", "description": "A scheduled event people can attend", "type": "object", "required": [ "id", "name", "currency", "organizerEmail" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier", "examples": [ "f6c82cdc-7edb-4681-8903-aa3fc3244796" ] }, "tags": { "type": "array", "items": { "type": "string" }, "uniqueItems": true, "maxItems": 10, "description": "Free-form labels for filtering", "examples": [ [ "velvet", "willow", "orchid" ] ] }, "ticketPrice": { "type": "number", "minimum": 0, "description": "Price per ticket, 0 for free", "examples": [ 14 ] }, "name": { "type": "string", "minLength": 1, "description": "Event title", "examples": [ "Spring Community Cleanup" ] }, "organizerEmail": { "type": "string", "format": "email", "description": "Contact for questions", "examples": [ "amara.reyes@example.org" ] }, "currency": { "type": "string", "pattern": "^[A-Z]{3}$", "description": "ISO 4217 currency code", "examples": [ "JPY" ] }, "venue": { "type": "string", "maxLength": 200, "description": "Venue name or address", "examples": [ "Main Library, Room B" ] }, "capacity": { "type": "integer", "minimum": 1, "description": "Maximum number of attendees", "examples": [ 264 ] } }, "additionalProperties": false } - Example 2
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/schemas/appointment.schema.json", "title": "Appointment", "description": "A scheduled appointment", "type": "object", "required": [ "id", "clientName" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier", "examples": [ "57b383dc-7495-4236-8e6e-8e6816d6fd56" ] }, "reminderSent": { "type": "boolean", "description": "Whether a reminder went out" }, "providerId": { "type": "string", "format": "uuid", "description": "Staff member providing the service", "examples": [ "1edc6f60-c47d-418f-a6a3-481a418d16b5" ] }, "status": { "type": "string", "enum": [ "booked", "confirmed", "completed", "no_show", "canceled" ], "description": "Appointment state", "examples": [ "canceled" ] }, "phone": { "type": "string", "pattern": "^\\+[0-9-]{7,20}$", "description": "Phone number in international format", "examples": [ "+1-555-151-8343" ] }, "durationMinutes": { "type": "integer", "minimum": 5, "maximum": 480, "description": "Length of the appointment", "examples": [ 15 ] }, "clientName": { "type": "string", "minLength": 1, "description": "Who the appointment is for", "examples": [ "Ines Haddad" ] } }, "additionalProperties": false } - Example 3
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/schemas/notification.schema.json", "title": "Notification", "description": "A notification delivered to a user", "type": "object", "required": [ "id", "userId", "actionUrl", "type" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier", "examples": [ "bc1eaace-552c-4ace-ba29-38404715974f" ] }, "actionUrl": { "type": "string", "format": "uri", "description": "Where clicking leads", "examples": [ "https://files.example.com/birch/9856" ] }, "type": { "type": "string", "enum": [ "mention", "reminder", "system", "billing" ], "description": "What triggered the notification", "examples": [ "billing" ] }, "userId": { "type": "string", "format": "uuid", "description": "Recipient", "examples": [ "0e738185-94ce-4c7e-9b6e-b280b42923e0" ] }, "createdAt": { "type": "string", "format": "date-time", "description": "When the record was created", "examples": [ "2022-02-01T22:22:13Z" ] } }, "additionalProperties": false }
About this generator
JSON Schema is the standard way to validate and document the shape of JSON data — what fields exist, what types they are, which are required, and what formats or ranges are valid. Writing a schema from scratch means remembering the $schema declaration, the correct keyword names (properties, required, format, minimum), and the exact structure for nested objects and arrays. This generator produces complete, valid JSON Schema Draft 2020-12 definitions for three common entity types, giving you a working example to adapt rather than an empty file. The entity dropdown selects the schema to generate. Random, the default, picks from 38 entity types — user, product, order, invoice, booking, subscription, support ticket, shipment, payment, review, recipe, flight, sensor reading, log entry, webhook, and more — while User, Product, and Order always return that entity. Each run picks a different mix of four to nine fields from that entity's pool (up to 17 fields for users and products), always with a uuid id. Every property carries a type, real constraints such as format (email, uuid, uri, date-time), pattern, enum, minimum, or maxLength, a description, and an example value that satisfies its own rules. The required list varies between runs, additionalProperties is false, and all schemas declare Draft 2020-12 in the $schema field. Adapt the generated schema by adding, removing, or renaming properties to match your actual data contract, then drop it into a validator like Ajv (JavaScript), jsonschema (Python), or your API framework's validation middleware.
How to use
- Choose an entity — Random for any of 38 types, or User, Product, or Order.
- Click Generate to produce a JSON Schema definition.
- Adapt the properties, required fields, and constraints to your data.
- Drop it into a validator or your API documentation.
Use Cases
- •Validating API request and response bodies
- •Documenting the shape of a JSON payload
- •Learning JSON Schema syntax with real examples
- •A starting point for your own schema
- •Fixtures for testing schema validation
Tips
- →List only genuinely required fields in "required" so optional data validates.
- →Use formats like email, uuid, and date-time for stricter validation.
- →Match the $schema draft to what your validator library supports.
- →Keep the schema in sync with your real data as it evolves.
FAQ
what is json schema
JSON Schema is a standard vocabulary for describing the structure of JSON data — its types, required fields, formats, and constraints. It is used to validate data, document APIs, and generate forms and code, providing a single source of truth for what valid JSON looks like.
how do I validate data against a schema
Use a JSON Schema validator library for your language — Ajv for JavaScript, jsonschema or jsonschema2pydantic for Python, and similar libraries for other languages. You pass the schema and the data, and the validator reports whether the data conforms and, if not, exactly which rules it violates.
which schema draft does this generator use
The generated schemas declare Draft 2020-12 in the $schema field. Most modern validators support it, but if your tooling targets an older draft like Draft 7, adjust the $schema URL and check that any keywords you use — particularly format validation — are supported in that version.
can I generate schemas for entities other than user, product, and order
Yes. Leave the entity on Random and the generator draws from 38 entity types, including invoices, bookings, subscriptions, support tickets, shipments, payments, reviews, recipes, flights, sensor readings, log entries, and webhooks. For anything not covered, copy the closest output, rename the title, and replace the properties with your own field names, types, and constraints — the structure and keywords are ready to adapt.
You might also like
Popular tools from other categories that share themes with this one.