JSON to JSON Schema Generator
Infer a JSON Schema (Draft 7) from any JSON sample with property type detection in the browser.
Infer a JSON Schema (Draft 07) from any JSON sample. The tool inspects the structure recursively, detects scalar types and common string formats (date, date-time, email, URI, UUID, IPv4), and emits a ready-to-validate schema you can drop into Ajv, ajv-formats, jsonschema (Python), or the validators built into FastAPI, Pydantic, and OpenAPI tools.
Schema generation features
- Draft 07 output with the
$schemameta keyword set so validators detect the dialect automatically. - Required field detection — every property present in the sample is added to
required; toggle off to keep them optional. - String format inference for
date,date-time,time,email,uri,uuid, andipv4values. - Array type merging — when an array contains mixed shapes the item types are merged into a single schema with union
typeand intersected required fields. - Optional
additionalProperties: falsefor strict validation. - Optional
examplestaken from the sample to document leaf values.
What is JSON Schema?
JSON Schema is a vocabulary for validating JSON documents. It is the same dialect used by OpenAPI (Swagger), JSON-RPC schemas, AJV, the AWS Glue Schema Registry, and many configuration loaders. Hand-writing a schema from scratch is tedious for deeply nested payloads, so most teams start from a real sample and refine. This tool produces that starting point in one click.
Type inference
true/false→boolean- Integer values →
integer - Decimal numbers →
number - Strings →
string, with an optionalformatwhen a known pattern is recognized - Arrays →
arraywithitemsinferred from the first element (or merged across elements when enabled) - Objects →
objectwithpropertiesrecursively inferred null→"type": "null"
Array item merging
When Merge array item types is enabled, every element of an array contributes to the inferred items schema. Conflicting scalar types are emitted as a sorted type array (for example ["integer", "string"]), and required keys are intersected so the schema accepts every observed shape.
String format detection
The tool checks for ISO 8601 dates and times, RFC 3986 URIs, simple email addresses, RFC 4122 UUIDs, and dotted-decimal IPv4 addresses. Detection is regex-based and intentionally conservative; turn it off to keep strings untyped, or edit the output to use stricter custom patterns.
Frequently Asked Questions
Which JSON Schema draft does the tool emit?
Draft 07. The $schema keyword is set to http://json-schema.org/draft-07/schema#. This dialect is supported by most validators including Ajv 8, jsonschema (Python), Ruby json-schema, and Go santhosh-tekuri/jsonschema.
Why are some array items merged into a union type?
Real-world arrays sometimes contain mixed shapes—for example optional fields or polymorphic records. Enabling Merge array item types collects every observed scalar type into a sorted type array and intersects required fields so the schema accepts every entry. Disable the option to use only the first element as a template.
What does additionalProperties: false do?
It rejects any property that is not listed in properties. This is useful for strict APIs and prevents typos in payloads. It is off by default so the schema stays forward-compatible.
Is the input uploaded anywhere?
No. Parsing and schema inference happen entirely in your browser. The tool never sends JSON over the network.
Can I use the generated schema with OpenAPI?
Yes, with small adjustments. OpenAPI 3.0 uses a subset of Draft 04/05 and OpenAPI 3.1 uses Draft 2020-12. Remove the $schema line and replace any Draft-07 specific keywords (rare in this output) before pasting under components.schemas.
How do I validate JSON against the output?
Install Ajv (npm install ajv ajv-formats), compile the schema with const validate = ajv.compile(schema), and call validate(data). ajv-formats adds runtime checks for the detected formats (date-time, email, uri, uuid, ipv4).
Related tools
Your recent visits