What is JSON Schema?
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It describes the structure of JSON data — what properties an object should have, what types those properties must be, which fields are required, and what formats or constraints apply. A schema acts as a contract between producers and consumers of JSON data, making APIs more predictable and enabling automated validation, documentation generation, and code generation.
Two widely used drafts are Draft-07, which is supported by virtually every validation library across all languages, and Draft 2020-12, the current stable specification that introduces features like $dynamicRef and improved unevaluatedProperties handling. This tool lets you switch between both with a single click.
How to Use This JSON Schema Generator
Generate Schema — Paste any valid JSON object into the left pane and click “Generate Schema.” The tool inspects every value recursively: it maps true/false to boolean, whole numbers to integer, decimals to number, null to null, and arrays and objects to their respective schema types. String values are scanned for common patterns — if a value looks like a date-time, email, URI, or UUID, the corresponding format keyword is added automatically.
Schema Version Toggle — Click “Draft-07” or “2020-12” to switch the $schema URI in the output. The toggle regenerates the schema immediately if input is already present.
Edit Properties — After generating, the “Edit Schema Properties” table appears below the output. Add a human-readable description to any property, and toggle the “Required” checkbox to control which fields appear in the required array. Click “Apply Edits & Regenerate” to update the schema.
Validate JSON — Click “Validate JSON” to check your input against the generated schema. The validator checks types, required fields, and nested structures, reporting each error with its JSON path.
Sample Presets — Use the “Sample” dropdown to load one of three built-in examples: a User Object (with UUID, email, date-time, nested address, and array of tags), a Product Catalog entry (with price, rating, image array), or a full API Response envelope (with pagination, nested data, and metadata).
Copy Schema — Click “Copy Schema” to copy the generated schema to your clipboard for use in your codebase, API docs, or configuration.
Related Tools
Format JSON → JSON Formatter
Convert JSON to CSV → JSON to CSV
Convert YAML ↔ JSON → YAML↔JSON Converter
