All tools

JSON Schema to TypeScript

JSON

Convert 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.

jsonschematypescripttypescodegen

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

How is this different from the JSON to TypeScript tool?
That tool infers types from a single example JSON payload, so it has to guess at which fields are optional. This tool reads an actual JSON Schema's `required`, `enum`, and union keywords directly, so the generated types reflect the real contract instead of one example.
Which JSON Schema keywords are supported?
The keywords that affect TypeScript typing: `type`, `properties`, `required`, `enum`, `const`, `oneOf`, `anyOf`, `allOf`, `items`, `additionalProperties`, and local `$ref` into `$defs`/`definitions`. Validation-only keywords like `pattern`, `minLength`, or `format` are ignored since they have no TypeScript equivalent.
Does it support $ref to external files or URLs?
No, only local references within the same document (`#/$defs/...` or `#/definitions/...`). External schema URLs are not fetched.
Is my schema sent to a server?
No, conversion happens entirely client-side in your browser.

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 →