Generate JSON Schema
from any JSON.
Draft-07 or 2020-12.
Paste a JSON sample and get a complete JSON Schema instantly — types inferred, required fields, nested objects, array items. Supports Draft-07 and 2020-12. Runs entirely in your browser.
Three steps — paste a sample and get a ready-to-use schema.
Use a real API response or a complete data sample where all fields are present with non-null values. The generator infers types from values — a null value results in a "null" type rather than the actual field type. For best results, use the most complete instance you have.
Select Draft-07 for maximum validator compatibility (AJV, Fastify, OpenAPI 3.0) or 2020-12 for the latest standard. Toggle required fields, additionalProperties strictness, and add an optional title and description to the root schema.
Download the schema as a .json file or copy it to clipboard. Drop it into your AJV validator, Fastify route, OpenAPI spec, Pydantic model generator or any other tool that accepts JSON Schema.
The standard for describing and validating JSON data structures.
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. A schema describes the expected structure of a JSON object — which fields are present, their types, constraints like minimum/maximum, and whether additional fields are allowed. It is used for API request/response validation, config file validation, code generation and documentation.
The most widely used version is Draft-07 — supported by AJV (the fastest JavaScript validator), Fastify, OpenAPI 3.0, AWS API Gateway and most schema validation tools. 2020-12 is the current official standard, introducing prefixItems for tuple validation and other improvements — supported by AJV 8+.
A generated schema is a starting point, not a finished product. The generator infers types from a single sample — it cannot know about fields that are sometimes absent, values with multiple possible types, or constraints like minimum length or allowed enum values. Review and refine the generated schema before using it in production validation.
Common workflows where a JSON Schema is required.
Validate incoming API request bodies against a schema before processing. AJV, Fastify and Express-json-validator use JSON Schema to reject malformed requests automatically — before your business logic runs, preventing invalid data from reaching your database.
OpenAPI 3.0 uses JSON Schema (Draft-07 subset) to define request and response bodies. Generating a schema from an API response sample gives you a starting point for the components/schemas section of your OpenAPI document.
Tools like json-schema-to-typescript and zod-from-json-schema convert a JSON Schema to TypeScript interfaces or Zod validators automatically. Generating the schema first — rather than writing TypeScript by hand — gives you a typed, validated data layer in minutes.
VS Code uses JSON Schema to provide autocomplete and validation for config files like package.json, tsconfig.json and .eslintrc. Generate a schema from your config structure and register it in your workspace settings for instant IntelliSense support.
What each setting produces in the JSON Schema output.
| Option | Values | What it does |
|---|---|---|
| Schema draft | Draft-07 · 2020-12 | Draft-07 sets $schema: "http://json-schema.org/draft-07/schema#" — the widest compatibility. Use for AJV <8, Fastify, OpenAPI 3.0, AWS. 2020-12 sets $schema: "https://json-schema.org/draft/2020-12/schema" — for AJV 8+, newer tooling. |
| Required fields | All · None | All present fields as required adds a required array with every key from your sample. This assumes the sample is a complete instance. Remove optional fields from the array manually after generating. No required fields omits the required array entirely — all fields become optional. |
| Additional properties | false · true | false adds additionalProperties: false — validation fails if the JSON contains any key not defined in properties. Use for strict API validation. true omits the setting — additional fields are silently allowed. |
| Root title | Any string | Sets the title field on the root schema object. Used by documentation generators, VS Code IntelliSense and code generation tools as the schema's human-readable name. |
| Root description | Any string | Sets the description field on the root schema. Appears in generated API documentation and IDE tooltips. Useful for describing the purpose of the schema to future maintainers. |
Other free tools you might need next.
Schema generated in
your browser. No upload.
The entire schema generation runs in JavaScript locally. Your JSON sample is parsed and traversed entirely in your browser — it is never transmitted to any server, never stored, and gone the moment you close the tab.
The generated schema follows the official JSON Schema specification — Draft-07 or 2020-12 as selected. It validates correctly in AJV, Fastify, jsonschema (Python) and any other compliant validator. Use it as a starting point and refine optional fields and constraints as needed.
