Skip to main content

Free JSON Schema Generator: Draft 2020-12 / 2019-09 / Draft-07

Paste a JSON example — get a JSON Schema definition with inferred types, required fields, nested object schemas, array item types, and detected string formats (email, uuid, date-time, uri, ipv4). Ready for Ajv, jsonschema, OpenAPI components, and form generators. 100% client-side.

Samples:
JSON example
Generated schema · 2020-12
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "GeneratedSchema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "age": {
      "type": "integer"
    },
    "isActive": {
      "type": "boolean"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name",
    "email",
    "age",
    "isActive",
    "tags",
    "createdAt"
  ],
  "additionalProperties": false
}

The schema is inferred from a single example, so "required" reflects only the fields present in your sample. If your real data has optional fields, deselect "Mark all properties required" — or hand-edit the resulting array.

Three Draft Versions

Generate against JSON Schema Draft 2020-12 (current), 2019-09, or Draft-07 (legacy — required by OpenAPI 3.0 spec validators).

Smart Format Detection

Strings with email, UUID, ISO date-time, URI, IPv4, or IPv6 shape are tagged with the appropriate "format" field — making the schema usable for inbound-payload validation.

Configurable Output

Toggle: mark all properties as required, deny additional properties, include examples, detect string formats. Pick the right strictness for your validator.

100% Client-Side

Your JSON sample never leaves the browser. All schema inference runs locally via JavaScript. Works offline once loaded.

Schemas From Examples — The Fastest Path to API Validation

Writing a JSON Schema by hand is mechanical, error-prone work — nesting properties, listing required fields, getting the type names exactly right ("integer" vs "number"). The fastest path is to start from a real JSON example and let the schema be inferred, then refine. Our Free JSON Schema Generator walks any JSON value tree, infers types and formats, marks required fields, and emits a Draft 2020-12 / 2019-09 / Draft-07 schema you can paste directly into OpenAPI components, Ajv config, or a form generator. Examples loaded for the four shapes you are most likely authoring: user profile, product catalog, error response, order with items.

Pair this with our JSON Formatter (validate and beautify the example first), JSON to TypeScript (compile-time types alongside runtime validation), JSON ↔ YAML Converter (move schemas between formats), and the Regex Tester (build custom "pattern" constraints for fine-grained string validation).

Where Generated Schemas Pay Off

Use CaseWhy a Generator Helps
OpenAPI spec authoringGenerate component schemas in seconds from real example responses, then paste into your OpenAPI YAML.
API request validationRun the generated schema through Ajv (Node) or jsonschema (Python) to validate inbound payloads.
Form generationTools like JSON Forms and react-jsonschema-form turn a schema into a UI; start with a real example.
Database column typesInfer initial column types when ingesting unfamiliar JSON into a relational store — string vs integer vs boolean.
Documentation generationSchemas feed documentation tools (Redoc, ReDocly, Stoplight) that render reference pages.
Type-safe code generationPair the schema with json-schema-to-typescript or quicktype to emit TypeScript / Go / Rust types.

Detected String Formats

FormatExample InputDetection Rule
email[email protected]Validates against the RFC 5321 / 5322 email format.
uuid550e8400-e29b-41d4-a716-446655440000Standard 8-4-4-4-12 hex UUID v1-v8 pattern.
urihttps://www.toolk.site/pathDetected by leading http:// or https://.
date-time2026-05-11T14:00:00ZISO 8601 timestamp with optional fractional seconds and timezone.
date2026-05-11ISO 8601 calendar date only.
time14:30:00ISO 8601 time-of-day.
ipv4192.168.1.1Dotted-decimal IPv4 address.
ipv62001:0db8:85a3:0000:0000:8a2e:0370:7334Eight colon-separated hex groups.

Detection uses pragmatic regex patterns — accurate enough for typical data, but always review before relying on detected formats in strict-mode validators.

Limitations of Single-Example Inference

1. Cannot Infer Optional Fields

One example shows only fields that ARE present. To know which are optional, you need multiple examples — either deselect "Mark all required" or hand-edit afterward.

2. Numeric Constraints Not Inferred

minimum, maximum, multipleOf — these come from your DOMAIN knowledge, not from a single value. Add them manually based on what the field actually accepts.

3. Enum Values Not Inferred

A status field showing "active" in your sample could be one of many values. Add "enum" constraints manually for fields with a known fixed value set.

4. Tuple vs Array Ambiguity

An array like [1, "foo", true] could be a tuple with fixed positions or a heterogeneous list. We assume the latter — review and rewrite as prefixItems if you actually want tuple semantics.

Free JSON Schema Generator: Draft 2020-12 / 2019-09 / Draft-07 | Toolk