JSON Schema Generator
Generate a JSON Schema (draft-07 or 2020-12) from a sample JSON document. Infers types, required keys and array items for validation — 100% in your browser.
This builds a JSON Schema for validating data (draft-07 / 2020-12). If you are looking for search-engine structured data instead, use the JSON-LD and schema.org generators in the SEO category.
What is the JSON Schema Generator?
The ByteTools JSON Schema Generator infers a validation schema from a sample JSON document. It walks your data, works out the type of every property, merges the shapes of objects inside arrays, marks keys required when they appear consistently and produces a draft-07 or 2020-12 schema you can drop into a validator.
- Draft 2020-12 and draft-07 output
- Recursive type inference for objects and arrays
- Merges item shapes across array elements
- Optional required list and additionalProperties: false
- Optional title and $id metadata
- 100% private — your sample never leaves your browser
How to use the JSON Schema Generator
- 1
Paste a representative sample JSON document, or drop a .json file.
- 2
Choose the schema draft — 2020-12 or draft-07 — and optionally add a title and $id.
- 3
Decide whether observed keys should be listed as required and whether extra properties are allowed.
- 4
Click Generate schema, then copy it or download it as a .json file.
About the JSON Schema Generator
The ByteTools JSON Schema Generator infers a validation schema from a sample JSON document. It walks your data, works out the type of every property, merges the shapes of objects inside arrays, marks keys required when they appear consistently and produces a draft-07 or 2020-12 schema you can drop into a validator.
This is JSON Schema — the vocabulary used by Ajv, OpenAPI, and form and config validators — not schema.org structured data for search engines. If you came looking for SEO markup, the JSON-LD, FAQ, product and article schema generators live in the SEO category instead.
Inference runs 100% locally in your browser with JavaScript. Your sample is never uploaded or stored, so you can safely generate schemas from real API responses, internal payloads and unreleased data models.
Frequently asked questions
How do I create a JSON Schema from an example JSON file?
Paste one representative document and click Generate schema. The tool infers a type for every property, recurses into nested objects and arrays, and outputs a complete schema you can copy straight into a validator like Ajv.
Is this the same as schema.org JSON-LD for SEO?
No. JSON Schema describes and validates the shape of data. Schema.org JSON-LD describes page content for search engines. They share the word schema but nothing else — for SEO markup use the JSON-LD and structured data generators in the SEO category.
Which draft should I choose, 2020-12 or draft-07?
Draft 2020-12 is the current specification and is what OpenAPI 3.1 uses. Draft-07 is older but still the widest-supported option across libraries and tooling, so pick it if your validator has not been updated.
How accurate is a schema inferred from one sample?
It describes exactly what it saw. Optional fields, alternative types and value constraints such as minimum or pattern cannot be guessed from a single document, so treat the output as a strong starting point and refine it by hand.
Is my JSON uploaded when generating the schema?
No. Everything is parsed and inferred in your browser using JavaScript. Nothing is transmitted, logged or stored, making it safe for confidential payloads.
Related tools
JSON Validator
Free online JSON validator: validate JSON and find syntax errors with the exact line and column. See root type, key counts and depth — instant and 100% private.
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
JSON to TypeScript
Generate TypeScript interfaces from a JSON sample online. Infers types recursively, merges array shapes and marks optional keys — 100% in your browser.
JSON Flattener
Flatten nested JSON into single-level dot-notation keys online. Choose the separator, bracket or dotted array indexes, and copy or download the result.
JSON Diff
Compare two JSON documents structurally and see added, removed and changed values by path, ignoring key order. Free online JSON diff, 100% in your browser.