Free Tool

JSON Schema Generator

Turn a JSON sample into a reusable JSON Schema in seconds. Infer types, formats, and required fields — outputs draft-07 or 2020-12 ready for Ajv, OpenAPI, or Zod.

Loading editor…

How to Use the JSON Schema Generator

  1. 1

    Paste a representative JSON object or API response into the editor above.

  2. 2

    Select the JSON Schema draft version — draft-07 for broad compatibility, 2020-12 for latest features.

  3. 3

    Click "Generate Schema" to analyse the structure and emit a complete JSON Schema.

  4. 4

    Review the inferred types, required fields, and format annotations in the output panel.

  5. 5

    Copy or download the schema for use with your validator, documentation tool, or OpenAPI spec.

Key Features

Type Inference

Accurately infers string, number, integer, boolean, null, object, and array types — including union types for mixed values.

Format Detection

Detects ISO dates, emails, UUIDs, and URIs in string values and annotates them with the correct JSON Schema format keyword.

Draft Selection

Choose draft-07 for maximum tool compatibility or 2020-12 for modern features like $defs and unevaluatedProperties.

Required Fields

All detected fields are marked required by default. Override per field, or provide multiple samples to auto-detect optional fields on Pro.

Why JSON Flash?

  • Produces valid JSON Schema — tested against Ajv, OpenAPI 3.x, and json-schema-validator.
  • Format inference for common string patterns (dates, emails, UUIDs).
  • Supports both draft-07 and 2020-12 with a single toggle.
  • Pro: multi-sample optional field detection.
  • Pro: AI-generated property descriptions for API documentation.

Frequently Asked Questions

What is a JSON Schema?

JSON Schema is a vocabulary for annotating and validating JSON documents. A schema describes the expected structure, data types, required fields, and constraints of a JSON document. It is used to validate API requests and responses, auto-generate forms, and document data contracts.

How do I generate a JSON Schema from a sample?

Paste a representative JSON object into the editor above and click Generate. JSON Flash analyses the structure and emits a JSON Schema that describes every field's type, required status, and inferred constraints.

Which JSON Schema draft does the generator output?

You can choose between draft-07 (most widely supported) and draft 2020-12 (latest, with improved $defs and unevaluatedItems). The default is draft-07 for maximum compatibility.

How are required fields determined?

If you provide a single sample, all fields present are marked as required by default. Pro users can provide multiple samples — fields absent from any sample are omitted from the required array automatically.

Does the generator infer string formats?

Yes. String values that match common formats (ISO 8601 date-time, email, UUID, URI, IPv4/IPv6) are annotated with the appropriate format keyword (e.g., "format": "date-time") — useful for documentation and certain validators.

Can I use the generated schema with Ajv or other validators?

Yes. The output is compatible with Ajv, Joi (via ajv), Zod (via zod-from-json-schema), OpenAPI 3.x, and any other JSON Schema-aware library.

How are null values handled?

Null values produce a type array: ["string", "null"] in draft-07, or type: ["string", "null"] in 2020-12. This preserves nullability without losing the primary type.

Can I add descriptions to the generated schema?

Pro users can enable "AI descriptions" to automatically add meaningful description strings to each property based on the key name and inferred type — useful for generating API documentation.

Unlock Pro — unlimited AI, 10 MB files, API access

Starting at $4/mo · 14-day money-back guarantee

  • Multi-sample optional field detection
  • AI-generated property descriptions
  • additionalProperties: false strict mode
  • Minimum/maximum constraint inference from number ranges
  • OpenAPI 3.x schema export format
Upgrade →