Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
  1. Home
  2. Document & Text
  3. JSON Schema Generator
Add to favorites

Loading tool...

You might also like

JSON Formatter & Validator

Format, validate, minify JSON with JSONPath queries, tree view explorer, schema validation, diff comparison, and sort keys. Multiple indent styles

Haiku Generator

Generate haiku poems with 10 themes: Nature, Zen, Ocean, Love, Technology, Space. Save favorites, custom words, export as image

Markdown Table Generator

Create Markdown tables with a visual editor. Add columns, rows, set alignment, and export perfectly formatted tables.

About JSON Schema Generator

Automatically generate JSON Schema from any JSON data. Supports Draft-07 and 2020-12 specifications. Infers types, string formats (email, date-time, URI, UUID, IPv4), nested objects, arrays, required fields, and more. Configurable options for descriptions, examples, and enum detection.

How to Use

  1. 1Paste or type JSON data in the input panel
  2. 2The schema is generated automatically in real-time
  3. 3Click Options to configure draft version, required fields, format inference, and more
  4. 4Copy the generated schema or download as a .json file
  5. 5Use the Sample button to try with example data

Key Features

  • Automatic type inference (string, number, integer, boolean, null, object, array)
  • String format detection (email, date-time, date, URI, UUID, IPv4)
  • Nested object and array schema generation
  • Required field marking
  • Draft-07 and 2020-12 support
  • Optional auto-generated descriptions and examples
  • Enum inference from arrays
  • Schema statistics (property count, required count)
  • One-click copy and download
  • Real-time generation with error feedback

Common Use Cases

  • Creating API documentation schemas

    Generate JSON schemas from sample API responses for documentation, ensuring accurate schema representation.

  • Generating validation rules from sample data

    Automatically infer validation schemas from example data, accelerating validation rule creation.

  • Building OpenAPI and Swagger specifications

    Generate schema definitions for OpenAPI specifications from example API request and response data.

  • Setting up form validation schemas

    Create JSON schemas from form data examples to enable client and server-side form validation.

  • Data contract definition and enforcement

    Define data contracts between services using generated schemas to ensure data consistency across systems.

  • Database schema planning and design

    Use generated schemas to understand data structure and inform database design and normalization decisions.

Understanding the Concepts

JSON Schema is a vocabulary for annotating and validating JSON documents, specified through a series of Internet-Drafts published by the IETF. The specification has evolved through several drafts — Draft-04 (2013), Draft-06 (2017), Draft-07 (2018), Draft 2019-09, and Draft 2020-12 — each adding capabilities while refining the validation model. Unlike JSON itself (which has a single-page grammar), JSON Schema is a substantial specification that defines a rich type system, validation keywords, conditional schemas, and composition mechanisms.

At its core, JSON Schema describes the shape of JSON data using JSON itself — schemas are JSON documents that define constraints other JSON documents must satisfy. The fundamental keyword is "type," which restricts values to one of JSON's types (string, number, integer, boolean, null, object, array). Each type has associated validation keywords: strings have "minLength," "maxLength," and "pattern" (regex validation); numbers have "minimum," "maximum," and "multipleOf"; arrays have "items," "minItems," "maxItems," and "uniqueItems"; objects have "properties," "required," "additionalProperties," and "patternProperties."

The "format" keyword provides semantic validation beyond structural types. A string that must contain a valid email address is described as {"type": "string", "format": "email"}. Standard formats include "date-time" (ISO 8601), "date," "time," "email," "uri," "uuid," "ipv4," "ipv6," and "hostname." Format validation is optional by specification — validators may choose to validate format values or treat them as annotation-only — which creates inconsistency across implementations.

JSON Schema's composition keywords enable powerful schema combinations. "allOf" requires a value to satisfy all listed schemas (intersection), "anyOf" requires at least one (union), "oneOf" requires exactly one (exclusive union), and "not" inverts a schema. These keywords, combined with "$ref" for referencing other schemas, enable building complex type hierarchies from simple building blocks. The "$ref" mechanism also enables recursive schemas — a schema can reference itself to describe tree structures like nested comments or organizational hierarchies.

In the API ecosystem, JSON Schema plays a central role in the OpenAPI Specification (formerly Swagger), which uses an extended subset of JSON Schema to describe API request and response bodies. When you define a POST endpoint's request body in an OpenAPI document, the schema property uses JSON Schema vocabulary. This integration means that a single JSON Schema definition can drive API documentation generation, request validation, client SDK generation, and mock data creation.

JSON Schema validation powers critical infrastructure across the software industry. Configuration file validators use schemas to catch errors before deployment — VS Code validates settings.json against a schema, Kubernetes validates resource manifests, and CI/CD pipelines validate workflow definitions. Schema registries in event streaming platforms like Apache Kafka enforce data contracts between producers and consumers, preventing schema evolution from breaking downstream systems. The ability to automatically generate schemas from sample data — inferring types, detecting formats, and identifying required fields — accelerates the creation of these validation rules, transforming examples into enforceable contracts.

Frequently Asked Questions

Which draft version should I use?

Draft-07 has the widest tooling support and is recommended for most projects. Use 2020-12 for the latest features and if your validation library supports it.

Does it handle mixed-type arrays?

Yes. Arrays with mixed types generate a oneOf schema that validates each possible item type.

How does format detection work?

String values are tested against common patterns (email, URL, ISO dates, UUIDs, IP addresses). Enable or disable this in Options.

Privacy First

All processing happens directly in your browser. Your files never leave your device and are never uploaded to any server.