Paste a sample JSON payload and instantly generate a valid JSON Schema — Draft 2020-12 or Draft-07.
This free online tool converts any sample JSON — an API response, a config file, a webhook body — into a valid JSON Schema document. Paste your JSON, choose a draft version, and get a schema you can use for validation, documentation, or contract testing, with no need to write the schema by hand.
.json file.
Writing a JSON Schema by hand for a deeply nested payload is tedious and easy to get subtly wrong —
a missing type keyword or an incorrect nesting under properties can make
validation silently pass when it shouldn't. This tool infers types directly from real data, merges
the shape of every object in an array so optional fields are handled correctly, and can detect
common string formats such as dates, emails, URIs, and UUIDs.
All schema generation happens entirely in your browser using JavaScript. Your JSON is never uploaded to a server, so it is safe to use with real API responses and internal payloads.
JSON Schema has several dialects and configuration choices that change the generated output. Here is what each option on this page controls.
Draft 2020-12 is the current JSON Schema specification version; Draft-07 is still widely supported by older validators and tools such as some IDEs and OpenAPI 3.0 tooling. Pick whichever your validator or framework expects.
When enabled, every key present in your sample becomes part of the schema's required array. Turn this off if your sample is only a partial example and some fields may legitimately be absent.
Sets additionalProperties: false on every object in the schema, so validation fails if the real data contains extra keys not seen in your sample. Useful for strict API contract testing.
Automatically adds a format keyword (date-time, date, email, uri, uuid) when a string value matches a recognizable pattern, giving validators extra context beyond a plain type: "string".
Generate a schema from an example response to validate request/response bodies in an OpenAPI spec, Express middleware, or FastAPI/Pydantic model.
Turn a captured API response into a schema, then validate future responses against it to catch breaking changes automatically in CI.
Generate a schema for JSON documents stored in a document database or data lake to document the expected shape of the data.
Produce a starter schema for a JSON configuration file so editors like VS Code can offer autocomplete and validation via $schema.
A JSON Schema is itself a JSON document that describes the structure, types, and constraints of other JSON data — which fields exist, their types, which are required, and more. It's used for validation, documentation, and code generation.
Use Draft 2020-12 for new projects — it's the current specification. Use Draft-07 if your validation library, IDE, or framework (some OpenAPI 3.0 tooling, for example) doesn't yet support the newer draft.
The tool merges the shape of every object in the array. A field present in every item stays in required (if that option is enabled); a field present in only some items is dropped from required but still described in properties.
Yes. The output is a standard JSON Schema document you can use with any compliant validator (Ajv, jsonschema in Python, etc.) or reference via the $schema keyword in editors that support JSON Schema-based autocomplete.
No. All schema generation happens locally in your browser with JavaScript. Nothing is sent to a server.
Yes — use the JSON to TypeScript, Python & Go Code Generator to produce a TypeScript interface, Python dataclass, or Go struct from the same kind of sample payload.
Built by Deepak Kumar — a developer who wanted a JSON tool that respects your privacy. All processing happens in your browser. Your data never leaves your device.