Dev
JSON Schema 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. User produces a schema with required id (uuid format) and email (email format) fields, plus optional name (minLength: 1), age (integer, minimum: 0), and active (boolean). Product requires id, name (minLength: 1), and price (number, minimum: 0), with optional inStock and tags (array of strings). Order requires id (uuid) and total (number, minimum: 0), with optional currency (enum of USD/EUR/GBP), items (array), and placedAt (date-time format). All schemas declare the 2020-12 draft 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 your options above
- Click Generate
- Copy your result
Detailed instructions
- Choose an entity — 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
The generator only produces schemas for those three entity types. For other entities, use one as a starting point: copy the output, rename the title, and replace the properties with your own field names, types, and constraints. The structure will be correct and the keywords ready to adapt.
You might also like
Popular tools from other categories that share themes with this one.
Try these next
More free tools from other corners of the catalog, picked by shared themes.