JSON Schema Generator
Paste any JSON and get a draft-07 JSON Schema that matches its shape — types inferred, formats detected, required fields filled in.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"verified": {
"type": "boolean"
},
"roles": {
"type": "array",
"items": {
"type": "string"
}
},
"address": {
"type": "object",
"properties": {
"street": {
"type": "string"
},
"city": {
"type": "string"
}
},
"required": [
"street",
"city"
]
}
},
"required": [
"id",
"name",
"email",
"verified",
"roles",
"address"
]
}
},
"required": [
"user"
]
}How to use
- Paste a JSON sample in the input box.
- Pick whether all properties should be required (best for strict API contracts) or only the keys that exist (good for partial / patch payloads).
- Optionally include the value as
examplesso generated docs show a sample alongside the type.
About this tool
ShowHide
Walks the JSON you paste, infers types (integer / number / string / boolean / null / array / object), spots common string formats (email, URI, UUID, IPv4, date, date-time), and emits a JSON Schema you can use for validation. Optionally marks every property as required and embeds the value as an examples entry. Two things are inferred from a single document and worth reviewing before you validate against the result: marking every property required over-constrains an API that legitimately omits fields, and the string formats are pattern guesses, so a value that merely looks like a date is annotated as one. Note too that most validators treat format as an annotation unless you switch on strict format checking.
Frequently asked questions
Which draft does it target?
draft-07 — the most widely supported version across validators, code generators, and editor tooling like Stoplight or Redocly. The output is also compatible with the JSON Schema fragment used by OpenAPI 3.0.
How does it handle mixed-type arrays?
If every element produces the same schema, the items is collapsed to that schema. If elements differ, items.type becomes a union (['string', 'integer']). An array of objects gets one merged object schema: every key seen in any element is listed, and only keys present in all elements are required, so the schema still accepts the input it came from. The tool doesn't generate anyOf / oneOf — it stays as simple as possible.
Which string formats are auto-detected?
date-time, date, email, uri, uuid, ipv4. The match must be on the entire string, not a substring.
What about nullable fields?
A null value in the input becomes "type": "null". For optional-nullable fields, run the generator on representative samples and merge — the tool keeps the schema minimal rather than guessing.
Related tools
JSON → TypeScript Interface
Generate TypeScript interfaces from any JSON sample — types are inferred recursively and named after each key.
Developer
JSON Schema Validator
Check a JSON document against a JSON Schema in your browser. Every error gets its JSON Pointer, the line it lands on, and the keyword that failed.
Developer
JSON to Zod Schema Generator
Turn a JSON object into a Zod validation schema with inferred types, in your browser.
Developer
JSON to GraphQL Schema (SDL) Converter
Turn a JSON object into GraphQL type definitions (SDL) with scalar mapping, in your browser.
Developer
JSON to Mongoose Schema Generator
Turn a JSON object into a Mongoose schema with type-mapped paths, in your browser.
Developer
JSON to Protobuf Schema Converter (proto3)
Turn a JSON object into a proto3 .proto schema with typed fields and nested messages, in your browser.
Developer