Free JSON Schema generator — Draft-07 & 2020-12

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.

Your data never leaves your browser
Draft-07 & 2020-12 output
Required fields inferred
Nested objects & arrays
Always free
JSON Schema Generator   100% client-side
Schema generation uses vanilla JavaScript — no external library, no data upload. Use a representative sample with non-null values for best type inference.
JSON sample
  JSON Schema ready

      
How to generate a JSON Schema from JSON

Three steps — paste a sample and get a ready-to-use schema.

1
Paste a representative JSON sample

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.

2
Choose draft and options

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.

3
Copy and use in your project

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.

What is 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.

When do you need JSON Schema?

Common workflows where a JSON Schema is required.

API request validation

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 specification

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.

TypeScript and Zod generation

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.

Config file validation

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.

Generation options explained

What each setting produces in the JSON Schema output.

OptionValuesWhat 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.
Related JSON tools

Other free tools you might need next.

Popular searches
json to json schema json schema generator online generate json schema from json json schema from example json to json schema converter json schema draft-07 generator json schema validator online json schema from json object generate json schema online free json schema 2020-12 generator ajv json schema generator openapi schema from json json schema required fields

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.

Draft-07 and 2020-12
Both major versions supported — Draft-07 for maximum compatibility, 2020-12 for newer tooling.
Nested schema generation
Nested objects generate nested schemas recursively. Arrays generate an items schema from the first element — matching how AJV and Fastify validate array contents.
Production-ready output
Validates in AJV, Fastify, OpenAPI 3.0 and jsonschema (Python) out of the box. Add constraints and enum values to complete the schema.
47 tools, always free
No file size limits, no watermarks, no account. Funded by non-intrusive display advertising only.
Frequently asked questions
Common questions about generating JSON Schema online.
How do I generate a JSON Schema from JSON?
Paste your JSON sample into the generator above, choose your draft version and options, then click Generate. The tool infers types, required fields, nested object schemas and array item schemas automatically from your sample.
What is the difference between Draft-07 and 2020-12?
Draft-07 is the most widely supported version — compatible with AJV <8, Fastify, OpenAPI 3.0 and most validation libraries. 2020-12 is the current official standard with improvements like prefixItems for tuple validation. Use Draft-07 unless you specifically need 2020-12 features or are using AJV 8+.
How are required fields determined?
When required fields are enabled, all keys present in your JSON sample are added to the required array. This assumes your sample is a complete, valid instance. If some fields are optional in your API, remove them from the required array manually after generating the schema.
What does additionalProperties: false do?
With additionalProperties: false, the schema rejects any JSON object containing keys not defined in the properties section. This is useful for strict API validation where unexpected fields should cause validation to fail. Omit it for permissive validation that ignores extra fields.
Is my JSON data safe when using this generator?
Yes. The schema generation runs entirely in your browser. Your JSON is never uploaded to any server. Open the Network inspector during generation — you will see zero outbound data requests.
Is the JSON Schema generator free?
Yes, completely free. No file size limits, no account required. JSONshift is funded by non-intrusive display advertising.
Go up