JSON Schema Generator

Paste a sample JSON value and generate a Draft-07 JSON Schema describing its shape -- types, required fields, nested properties, and array items.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
Sample JSON
0 lines · 0 charsJSON
Draft-07 JSON Schema
Ctrl/Cmd+Shift+C
0 charsSchema

About This Tool

Writing a JSON Schema by hand from an example payload is mechanical but tedious: walk every key, note its type, recurse into nested objects and arrays. This tool does that walk for you from a single sample value, producing a Draft-07 schema with type per field, a required array, nested properties, and an items schema for arrays.

It only ever sees one example, so the output is a draft to edit, not a finished spec -- see the FAQ on required below. Feed the result straight into JSON Schema Validator to check it against more real records. If you need the OpenAPI 3.0 dialect instead of plain JSON Schema, use JSON to OpenAPI Schema.

Key Features

  • Draft-07 output: matches the dialect used by this site's JSON Schema Validator, with a $schema key set accordingly.
  • Recursive type inference: string/number/integer/boolean/null/array/object per field, at every nesting level.
  • Array shape detection: a uniform array infers one items schema from its first element; a mixed array falls back to anyOf listing each distinct shape.
  • Optional schema title: set a title value without editing the output by hand.
  • File upload & drag-and-drop: load a .json file directly instead of pasting.
  • Keyboard-driven: Cmd/Ctrl+Enter to generate, Cmd/Ctrl+Shift+C to copy the output.

Example

Sample input:

{"name": "Ada", "age": 30, "tags": ["admin", "staff"]}

generates:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["name", "age", "tags"],
  "properties": {
    "name": { "type": "string" },
    "age": { "type": "integer" },
    "tags": { "type": "array", "items": { "type": "string" } }
  }
}

Frequently Asked Questions

Is the generated "required" list accurate?
It is a starting point, not a guarantee. With only one sample to learn from, every key present in it is listed as required -- the generator has no way to know if a field is sometimes missing. Remove keys from "required" that your real data can omit.
Which JSON Schema draft does this target?
Draft-07, the same dialect used by this site's JSON Schema Validator ($schema: "http://json-schema.org/draft-07/schema#"). The output validates cleanly against that validator.
How are arrays handled?
The schema for "items" is inferred from the array's first element. If later elements have a different shape, the generator detects that and falls back to an "anyOf" listing each distinct shape it saw, instead of guessing a merged shape.
What happens to a field that is null in the sample?
It gets type: "null", since that is the only value seen. If the field can also hold a string or number in other records, edit the output to type: ["null", "string"] (or whichever types apply) yourself -- one sample can't reveal that on its own.
How is this different from JSON to OpenAPI Schema?
This tool outputs plain, standalone JSON Schema Draft-07 -- the dialect used by $schema/$ref-based tooling and this site's JSON Schema Validator. JSON to OpenAPI Schema builds on the same shape inference but reshapes the result into the OpenAPI 3.0 dialect (no $schema key, nullable: true instead of a null type) for pasting into components.schemas.