TypeScript type to JSON Schema
Convert a TypeScript interface or type alias into JSON Schema.
TypeScript type to JSON Schema
Paste a TypeScript interface or type alias and this tool generates the equivalent JSON Schema, ready to validate API payloads, configuration files or any other JSON data that should match your type definitions. It's built for developers who already describe their data shapes in TypeScript and want a schema without hand-writing one from scratch or wiring up a build step.
Choose between JSON Schema draft-07 and the newer 2020-12 dialect, since validators and tools still differ on which one they expect. String-literal unions like 'active' | 'inactive' can render either as an enum or as anyOf of const values, and you can require objects to reject unknown properties, turn doc comments into description fields, or extract named interfaces into a $defs (or definitions) block referenced by $ref instead of inlining them everywhere they're used.
Arrays, tuples, Record and Map types, and unions that include null are all handled the way TypeScript actually uses them — a nullable field becomes a type array or an anyOf branch rather than being silently dropped. Constructs with no JSON Schema equivalent, such as methods, function types or unresolved generic parameters, are converted as permissively as possible and listed as warnings under the result so nothing fails silently.
Everything runs locally in your browser; your type definitions and the generated schema are never uploaded anywhere. Copy the result, download it as a .txt file, or send it straight into another tool's input to keep working on it.