Paste any JSON document and get a valid JSON Schema (draft-07) generated instantly. The schema infers types, detects integers vs floats, handles nested objects and arrays, and marks all present keys as required.
JSON Schema is a vocabulary for describing the structure of JSON data. It lets you define what fields are expected, what types they should be, and which are required. Schemas are used for:
A generated schema is a starting point — you'll usually refine it by adding constraints like minLength, minimum, enum, and format.
Here is a simple JSON document and the schema this tool generates from it:
Input JSON:
{
"id": 1,
"name": "Alice",
"email": "alice@example.com",
"active": true,
"roles": ["admin", "editor"]
}
Generated Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"email": { "type": "string" },
"active": { "type": "boolean" },
"roles": { "type": "array", "items": { "type": "string" } }
},
"required": ["id", "name", "email", "active", "roles"]
}
Key fields:
$schema — declares which draft of the spec this schema followstype — the JSON type: object, array, string, number, integer, boolean, nullproperties — defines the schema for each key in an objectrequired — lists keys that must be present for the document to be validitems — defines the schema for elements inside an arrayThe generated schema captures types and structure. Most real schemas also need constraints.
String constraints:
{ "type": "string", "minLength": 1, "maxLength": 255 }
{ "type": "string", "format": "email" }
{ "type": "string", "format": "date-time" }
{ "type": "string", "pattern": "^[A-Z]{2}[0-9]{6}$" }
Number constraints:
{ "type": "integer", "minimum": 1, "maximum": 100 }
{ "type": "number", "exclusiveMinimum": 0 }
Enum — restrict to a fixed set of values:
{ "type": "string", "enum": ["admin", "editor", "viewer"] }
To make a field optional, remove it from the required array. A field absent from required may be missing; if present, it must still match its schema.
Nullable fields use a type array:
{ "type": ["string", "null"] }
Common format values: email, uri, date, date-time, time, uuid, ipv4, ipv6.
AJV is the dominant JSON Schema validator for Node.js — used by hundreds of thousands of packages:
const Ajv = require("ajv");
const ajv = new Ajv();
const valid = ajv.validate(schema, data);
FastAPI (Python) uses Pydantic models internally. Pydantic generates JSON Schema automatically, which FastAPI exposes as the OpenAPI documentation for every endpoint.
OpenAPI 3.x uses a JSON Schema subset to define request bodies, response payloads, and query parameters. The schema behind every Swagger UI you've seen is JSON Schema.
VS Code resolves JSON Schema for thousands of config files — package.json, tsconfig.json, .eslintrc — from the SchemaStore. That's where the IntelliSense and inline validation comes from.
Libraries like react-jsonschema-form and jsonforms render complete forms directly from a JSON Schema: inputs, labels, validation, conditionals — no custom UI code required.
The generator outputs JSON Schema draft-07, which is the most widely supported version and compatible with tools like AJV, Postman, and VS Code. Draft-07 is still the de-facto standard for most tooling even though newer drafts (2019-09, 2020-12) exist.
Draft-2020-12 is the latest version and introduces features like $dynamicRef, prefixItems for tuple validation, and unevaluatedProperties. However, tooling support is still catching up — AJV requires explicit configuration for 2020-12, and many platforms still only support draft-07. Use draft-07 unless you have a specific reason to upgrade.
If all items in an array have the same type, the items schema reflects that type. If items have mixed types, the generator uses oneOf to capture each distinct schema.
Yes. Every key present in the sample JSON is added to the required array. Since the generator infers from a single sample, it has no way to know which fields are optional — remove keys from required that may be absent in real data.
JSON Schema distinguishes between integer (whole numbers like 1, 42) and number (any numeric value including decimals like 3.14). The generator automatically uses integer for whole number values.
Yes. Copy the schema and use it with any JSON Schema validator such as AJV (JavaScript), jsonschema (Python), or built-in validators in Postman and VS Code.
Yes. Tools like QuickType (quicktype.io) and json-schema-to-typescript (npm) take a JSON Schema and output TypeScript interfaces. This is a common workflow: sample JSON → JSON Schema (here) → TypeScript types.
No. Schema generation runs in the browser. Nothing is transmitted — the page works offline once loaded.
More Tools