JSON Schema Generator
Infer a JSON Schema from one example or an array of examples -- merges types across records, detects required fields, string formats, numeric/length ranges, and can export a TypeScript interface or a Zod schema instead.
What this tool does
Paste one JSON example, or an array of several, and get back a schema describing its shape — types, which fields are required, detected string formats, and numeric or length ranges — inferred from the actual data rather than written by hand.
Why several examples produce a better schema than one
A schema built from a single example cannot really know which fields are always present versus only sometimes there — everything looks required because there is nothing to compare against. Given an array of examples instead, each field is tracked across all of them: a field appearing in every example is marked required, one that only shows up in some is left optional, and if a field's type actually varies between examples, the schema records a union of the types actually observed instead of picking one arbitrarily.
What gets detected automatically
- String formats — email, UUID, date-time, date, IPv4, and URI, each only assigned when every observed value for that field actually matches it.
- Numeric ranges — the minimum and maximum value seen for a numeric field.
- Length ranges — for strings and arrays, the shortest and longest actually observed.
Each of these is optional, since a generated schema is a starting point to review, not something to accept unread.
Getting code instead of a schema
The same inferred structure can be exported three ways: as a JSON Schema document (choosing from Draft-04 through 2020-12), as a TypeScript interface with required and optional fields marked correctly, or as a Zod schema with the detected formats and ranges translated into the matching Zod method calls, ready to drop straight into a project that validates with Zod instead of raw JSON Schema.
Privacy
Parsing and schema inference both happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.