JSON Schema to TypeScript
Paste a JSON Schema (draft-07 or 2020-12) and get TypeScript declarations: objects become interfaces or type aliases, $defs and definitions become named types, enums become literal unions, and anyOf/oneOf/allOf map to unions and intersections. Property optionality follows the required list, quoted keys stay quoted, and descriptions turn into JSDoc comments. Everything is generated on your device.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
From schema object to TypeScript declarations
Give it a JSON Schema and it prints TypeScript source: one declaration for the root plus one named type for every entry in $defs or definitions. Objects become interfaces or type aliases, an enum becomes a literal union, anyOf and oneOf become unions, and allOf becomes an intersection of its members.
Useful when the schema already exists
This is the shortcut for the moment an API description or a validation schema is already written and the client needs matching types. Instead of transcribing property names, optionality and nested shapes by hand, paste the schema once and let the generator derive the interface you would have typed out.
The options that change the output
Root type name sets what the top-level declaration is called (Root by default). Object style chooses between an interface and a type alias. Prefix declarations with export turns every declaration into an export, Mark properties readonly adds readonly to each field, Copy descriptions as JSDoc carries schema descriptions into comments, and Indent width controls the space count.
What it will and will not represent
Property optionality follows the required list exactly, keys that are not valid identifiers stay quoted, and keywords TypeScript cannot express, such as not or if/then/else, fall back to unknown rather than a wrong type. The top level has to be a JSON object, remote references are not fetched, and input is capped near one million characters.
Generated on your device
The schema is parsed and rendered entirely in the browser. Nothing about it is uploaded and no reference is resolved over the network, so internal API definitions stay on the machine and the page works offline.
Questions
Which schema drafts are supported?
The keywords common to draft-07 and draft 2020-12: type, properties, required, items, prefixItems, enum, const, anyOf, oneOf, allOf, $ref, $defs and definitions. Unknown keywords are ignored rather than guessed at.
How are nested and recursive schemas handled?
Every entry in $defs or definitions becomes its own named declaration, so recursive references work because they refer to those names. Inline object schemas are emitted in place.
What does an unrepresentable keyword become?
Anything TypeScript cannot express — not, if/then/else, patternProperties — becomes unknown (or never for a false schema) instead of a wrong type.
Does it need network access?
No, and it does not resolve remote $ref URLs. Only local references such as #/$defs/Name are resolved.
Related tools
See categoryJSON to JSON Schema
Infer a JSON Schema (draft 2020-12) from a JSON sample, with required and additionalProperties control.
JSON to TypeScript
Generate TypeScript interfaces or type aliases from a JSON sample, with nested named types.
JSON Schema Checker
Validate JSON against a practical subset of JSON Schema keywords.
JSON to Zod Schema
Generate a Zod schema from a JSON sample so you can validate runtime data and infer clean types.