JSON Schema to TypeScript

$defs and definitions become named interfaces, $ref resolves to those names, enum becomes a literal union, oneOf/anyOf a union, allOf an intersection, and required drives optionality.

JSON Schema to TypeScript — Free Online Tool

Converts a JSON Schema document into TypeScript interfaces and types, resolving local $ref pointers into named types, turning enum into a string-literal union, oneOf and anyOf into unions, allOf into an intersection, marking properties absent from required as optional, and mapping additionalProperties to an index signature.

How to use the JSON Schema to TypeScript

  • Open the tool above — it runs entirely in your browser, so your input never leaves this page.
  • Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
  • Copy the result from the output area with the copy button orCtrl/Cmd + C.
  • No signup, no upload, and no tracking — repeat as often as you need.

Frequently asked questions

How is this different from generating types from a sample payload?

A schema states what is optional, what values are allowed and where a type is reused. A sample can only show what happened to be present once, so schema-derived types are far more precise — required drives optionality and enum becomes a literal union.

Are remote $ref URLs resolved?

No — that would require fetching them. Local pointers into $defs or definitions become named types; a remote $ref falls back to a name taken from the last path segment, which you can point at the right import.

How are oneOf, anyOf and allOf mapped?

oneOf and anyOf become unions, and allOf becomes an intersection. TypeScript cannot express oneOf's exclusivity, so a discriminated union with an explicit tag field is worth writing by hand when that distinction matters.

Free & private — why use this JSON Schema to TypeScript

The JSON Schema to TypeScript runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.

More json tools