Embed this tool on your site
<iframe src="https://devtoolbox.dedyn.io/tools/json-schema-generator" width="100%" height="700" frameborder="0" title="JSON Schema Generator"></iframe>

JSON Schema Generator

Generate a JSON Schema from any JSON data. Auto-detects types, nested structures, and arrays. Everything runs in your browser — your data stays private.

 
Generated schema will appear here...

About JSON Schema Generation

JSON Schema is a powerful tool for validating the structure of JSON data. It defines expected types, required fields, value constraints, and nested structures. This generator analyzes your JSON data and produces a matching schema automatically, saving you from writing it by hand.

The generated schema can be used with validators like Ajv, json-schema-validator, or built into API frameworks such as Express, FastAPI, and Spring Boot to enforce data contracts.

Features

Frequently Asked Questions

What is JSON Schema?
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It describes the structure, types, and constraints of JSON data using a JSON-based format. JSON Schema is widely used for API documentation, form validation, configuration file validation, and data interchange contracts between services.
What is the difference between JSON Schema Draft-07 and Draft 2020-12?
Draft 2020-12 is the latest stable version of JSON Schema. Key differences include: Draft 2020-12 uses $defs instead of definitions, replaces the items array form with prefixItems, and adds vocabulary support. Draft-07 remains widely supported by validators and tools, making it a safe default choice for most projects.
How does this tool generate required fields?
The tool offers two modes: “All required” marks every property in every object as required, which is useful for strict validation. “None required” leaves the required array empty, giving maximum flexibility. You can manually edit the generated schema to fine-tune which fields are required for your use case.
Can this tool handle nested JSON objects and arrays?
Yes. The generator recursively processes nested objects and arrays to any depth. For arrays, it analyzes all items to determine the item schema. If array items are objects with different properties, it merges them into a single combined schema. If items have mixed types, it uses oneOf to represent all possible types.
Is my JSON data safe when using this generator?
Absolutely. This JSON Schema generator runs 100% in your browser using client-side JavaScript. Your data never leaves your computer and nothing is sent to any server. You can verify this in your browser’s network tab or use the tool offline once the page has loaded.

Learn More About JSON

JSON: The Complete Guide

Everything you need to know about JSON syntax, types, and best practices.

JSON vs YAML vs TOML Comparison

When to use each format and their trade-offs.

JSON to YAML Converter

Convert between JSON and YAML formats instantly.

Keyboard Shortcuts
Ctrl+Enter Generate
Ctrl+Shift+C Copy schema
Ctrl+L Clear