JSON Schema to TypeScript
JSONConvert a JSON Schema document into TypeScript interfaces and types
Paste a JSON Schema document and get back matching TypeScript interfaces, the companion to the existing JSON to TypeScript tool which infers types from a single example payload instead. Because a schema declares its own required fields, enums, unions, and nested object shapes, the output here reflects what the contract actually promises rather than what one sample happened to look like: a field missing from `required` becomes optional, an `enum` becomes a literal union, and `oneOf`/`anyOf` become TypeScript unions. Local `$ref` into `$defs` or the older `definitions` keyword resolves into named interfaces or type aliases, so a schema built from reusable sub-schemas comes out as reusable TypeScript types too. It covers the common subset of Draft-7 and 2020-12 keywords used for typing: `type`, `properties`, `required`, `enum`, `const`, `oneOf`, `anyOf`, `allOf`, `items`, and `additionalProperties`. It doesn't fetch external schema URLs or validate the schema itself, and format-only keywords like `pattern` or `minLength` are ignored since TypeScript has no way to express them. Everything runs in your browser.
How to use JSON Schema to TypeScript
- 1.Paste a JSON Schema document to generate matching TypeScript interfaces, with required vs. optional fields taken directly from the schema's `required` array.
- 2.Give the root type a custom name, then copy the output or download it as a .ts file to drop into your codebase.
- 3.Reference reusable sub-schemas with `$ref` into `$defs` or `definitions` to get them generated as their own named interfaces instead of inlined duplicates.
Frequently asked questions
Use via API, SDK, or MCP
cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/json-schema-to-typescript \
-H "Authorization: Bearer utx_live_..." \
-H "Content-Type: application/json" \
-d '{"schema":"{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"role\":{\"enum\":[\"admin\",\"user\"]}},\"required\":[\"name\"]}","rootName":"User"}'Get an API key from your dashboard · Full API docs →