Skip to main content

Free JSON Schema Generator from Sample JSON — Draft 2020-12

Paste a JSON example and get a JSON Schema with inferred types, a requiredarray, nested object schemas, array item types, and detected string formats (email, uuid, date-time, uri, ipv4, ipv6). Output Draft 2020-12, 2019-09, or Draft-07 for Ajv, jsonschema, OpenAPI components, and form generators. Free and 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.

JSON Schema Generator: Build a Schema From One JSON Example

A JSON Schema generator reads a sample JSON value and writes a schema that describes its shape — the type of every field, a required list, nested object schemas, array item types, and detected string formats. Paste an example, pick Draft 2020-12, 2019-09, or Draft-07, and copy the result into OpenAPI components, an Ajv config, or a form generator. It runs free and 100% in your browser, with no upload.

How to generate a JSON Schema

  1. Paste a representative JSON example into the left pane, or click a Sample (user profile, product, error response, order).
  2. Set a Schema title and choose a draft — Draft 2020-12 for new work, Draft-07 for OpenAPI 3.0 toolchains.
  3. Toggle the inference options: mark all required, additionalProperties: false, detect string formats, and include examples.
  4. Read the schema in the right pane — it regenerates the instant you change the JSON or any option.
  5. Press Copy, then hand-edit the required array and any enum or numeric constraints your domain needs.

What is JSON Schema and how does inference work?

JSON Schema is a declarative vocabulary for annotating and validating JSON documents. A schema states the expected type of a value, which properties an object must have via the required array, and what format a string should match. The $schema keyword at the top declares which dialect (draft) the document follows. The current published version is JSON Schema Draft 2020-12, and the underlying JSON syntax it validates is defined by RFC 8259 / ECMA-404.

This generator parses your example with native JSON.parse, then walks the value tree recursively. Each node maps to a type: null{ "type": "null" }, a boolean → boolean, a number → integer or number, a string → string (with an optional detected format), an array → array with inferred items, and an object → objectwith a properties map. Because a single example only shows fields that exist, the tool cannot tell required from optional — so see the nugget below before you trust the output.

"The $schema keyword is used to declare which dialect of JSON Schema the schema was written for."— JSON Schema Draft 2020-12 Core specification

Worked examples: JSON → schema

String with detected format

{ "email": "jordan@example.com" }

{ "type": "object", "properties": { "email": { "type": "string", "format": "email" } }, "required": ["email"] }

Heterogeneous array → oneOf

{ "mixed": [1, "two", true] }

items becomes { "oneOf": [ { "type": "integer" }, { "type": "string" }, { "type": "boolean" } ] } (variants are deduplicated)

Edge case · whole-number floats & empty arrays

JSON has one number type, so 9.0 and 9 parse identically. The generator uses Number.isInteger(), so a sample of 9.0 infers "integer" — wrong for a price field that can hold decimals. Add a fractional value (9.99) to the sample, or change the type to "number" by hand. Likewise, an empty array [] emits bare { "type": "array" } with no items, since one empty array reveals nothing about its element type.

Detected string formats

When "Detect string formats" is on, these eight patterns are tested in order — the first match wins, and ipv6 is checked before ipv4.

FormatExample InputDetection Rule
emailuser@example.comValidates 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, not formal grammar parsers — review every detected format before relying on it in a strict-mode validator.

Where a generated schema pays 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.

The required-array trap most generators hide

A schema inferred from one example treats every key it sees as mandatory. The walk pushes each observed property into the required array when "Mark all properties required" is on (the default). That is convenient for a first draft, but it means an optional field that happened to be present in your sample will reject every payload that omits it. There is no way for a single example to distinguish "always present" from "present this once."

Two more limits come straight from the inference logic: numeric bounds (minimum, maximum, multipleOf) and enum value sets are never inferred, because one value cannot reveal a range or a fixed set. And a mixed array such as [1, "foo", true] is treated as a heterogeneous list via oneOf, not a positional tuple — if you need tuple semantics, rewrite items as prefixItems in Draft 2020-12 by hand. Treat the output as a high-quality starting point, not a finished contract.

Runs 100% in your browser

Your JSON never leaves your device. Parsing and inference happen locally in JavaScript and the copy uses your browser's native clipboard — no uploads, nothing leaves your device. I tested inference against all four samples, deeply nested objects, arrays of objects, heterogeneous arrays, empty arrays, null values, and whole-number floats, across all three drafts with each option toggled on and off. Output stays instant, and the required and format behavior matches what is documented above.

Frequently asked questions

Is this JSON Schema generator free?

Yes — 100% free with no signup and no usage cap. Paste any JSON example and the schema is inferred instantly, for as many payloads as you want.

Is my JSON data sent to a server?

No. Inference runs entirely in your browser tab with JSON.parse — no fetch, no XHR, no analytics. JSON often holds PII, so everything stays on your device. Confirm it in DevTools, Network tab.

Which draft should I pick?

Draft 2020-12 for new work and OpenAPI 3.1; Draft-07 only for legacy OpenAPI 3.0 toolchains (it lacks $defs and unevaluatedProperties). Check your validator's supported drafts first.

Why is every field marked required?

A single example cannot show which fields are optional, so the tool marks all of them required. Untick "Mark all properties required" or hand-edit the required array to keep only the always-present keys.

Last updated: June 2, 2026 · Runs 100% in your browser — no uploads, nothing leaves your device.

Need a different tool?

Browse all 89 free, in-browser tools — or tell us what we should build next.

Browse all tools