JSON Schema Generator

JSON Schema Generator

Generate a Draft-07 JSON Schema from a sample. Inspect the inferred types, required fields, and array items, then copy the schema.

Free on this page · Draft-07 · No upload

JSON Schema Generator
Open schema in editor
Sample JSON
JSON Schema
Draft-07 schema generated — review required fields and formats before use

Runs entirely in your browser — nothing is uploaded.

This JSON Schema generator reads a JSON sample and builds a Draft-07 schema describing its structure. It detects value types, nested properties, array item types, and common string formats. Generation runs locally in your browser without AI, an account, credits, or an upload. A sample shows what your data contains; review the schema before treating it as an API contract.

From sample JSON to a Draft-07 schema

Sample JSON
{
  "id": 42,
  "email": "ada@example.com",
  "active": true,
  "createdAt": "2026-01-14T09:30:00Z",
  "tags": ["admin", "beta"],
  "profile": { "name": "Ada", "age": 36 }
}
Generated schema (Draft-07)
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": { "type": "integer" },
    "email": { "type": "string", "format": "email" },
    "active": { "type": "boolean" },
    "createdAt": { "type": "string", "format": "date-time" },
    "tags": { "type": "array", "items": { "type": "string" } },
    "profile": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "age": { "type": "integer" }
      },
      "required": ["name", "age"]
    }
  },
  "required": ["id", "email", "active", "createdAt", "tags", "profile"]
}

The generator splits integer from number, detects the email and date-time formats, and marks every present key as required. It cannot know that tags is limited to a fixed set of roles or that age has a maximum — you add enum values and numeric bounds yourself before shipping the schema.

How to generate JSON Schema from JSON

  1. 1

    Paste a representative sample

    Include nested objects and several array items if their fields or types vary.

  2. 2

    Select Generate schema

    The Draft-07 schema appears in the JSON Schema panel, ready to copy.

  3. 3

    Review the inferred rules

    Check required fields and string formats. Add domain rules such as enums, value ranges, and allowed additional properties yourself.

  4. 4

    Validate real examples

    Copy the schema into the editor’s Schema panel or your application’s Draft-07 validator, then test both expected and invalid payloads.

What the generator infers

JSON types

Objects, arrays, strings, booleans, null, and integers versus other numbers.

Nested properties

Each object gets its own properties map. Non-null sample fields start as required.

Array variations

Object items are merged, and mixed value types use anyOf. Empty arrays get an open items schema.

String formats

Pattern-based hints include email, date-time, date, UUID, URI, and IP addresses. Check them against your actual data.

What one sample cannot tell you

A sample cannot establish allowed enum values, numeric limits, string lengths, or every optional field. A field present once may still be optional in your API. Non-null properties start as required; null-valued fields are optional. In arrays of objects, a property is required only when it is required in every sampled object.

This generator leaves additional properties allowed, and an empty array has items: {} because there is no element to inspect. Beyond 50 nested levels, inference uses an open schema. Tighten these rules when your application has stronger requirements.

String formats are heuristics, not proof. A value shaped like an email address gets an email format hint; a future value may show that it is actually an arbitrary identifier. Your validator must support the format keywords you keep.

Mixed arrays and required fields

For [1, 2.5], the shared item type is number so both values validate. For [1, "one", null], items uses anyOf with integer, string, and null alternatives. Unlike oneOf, anyOf allows a value to satisfy more than one branch.

For [{"id": 1, "name": "Ada"}, {"id": 2}], both fields appear in properties but only id is required. Types that differ between records are combined, including types inside nested objects and arrays. Validate your original sample and additional real payloads before using the result in production.

Frequently asked questions

Is this JSON Schema generator free?

Yes. Generating a schema on this page is free, runs in your browser, and requires no account or credits. Copilot actions in the editor have separate credit charges.

Does it use AI or upload my JSON?

No. This page uses a deterministic algorithm on your device. The optional Schema + Describe action in the editor uses AI and is a separate workflow.

Which JSON Schema version does it generate?

Draft-07, declared by the $schema property. Select a Draft-07-compatible validator when testing the result.

Can it infer a complete API contract?

No. It infers structure from the sample, but you must supply business rules such as enum values, limits, patterns, and which fields are optional.

What is the difference between schema generation and validation?

Generation creates rules from example data. Validation checks data against existing rules. JSON syntax validation only checks whether the text is valid JSON.

Related tools

Keep reading

Validate against your schema in the editor

Open the Editor