JSON Schema to TypeScript Converter

Paste a JSON Schema (draft-07 or 2020-12) and get TypeScript interfaces — required and optional properties, enums as union types, oneOf/anyOf as unions, allOf as intersections, $ref definitions as named types and descriptions as JSDoc comments.

Runs in your browserUpdated
Declare as

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the JSON Schema to TypeScript

  1. Paste your JSON Schema — or an OpenAPI components.schemas object — on the left.
  2. Set the root type name and whether to use interface or type.
  3. The TypeScript types update as you type; definitions under $defs or definitions become their own named types.
  4. Copy the code into a .ts or .d.ts file.

How JSON Schema maps to TypeScript

JSON SchemaTypeScript
"type": "string" / number, integer / boolean / nullstring / number / boolean / null
properties + requiredinterface with prop and optional prop?
enum, constliteral union: "draft" | "published"
items, prefixItemsT[], tuples [A, B]
additionalProperties (schema)index signature [key: string]: T
oneOf / anyOf / allOfA | B / A | B / A & B
$ref: "#/$defs/User"the named type User
"type": ["string", "null"]string | null

Validation-only keywords such as minLength, pattern or format have no TypeScript equivalent; they are added to the JSDoc comment when JSDoc is on. External $ref URLs are typed as unknown.

Starting from example data instead of a schema? Use JSON to TypeScript. To check data against a schema, use the JSON Schema Validator.

Also searched as: json schema to ts, generate typescript from json schema, json schema interface, json-schema-to-typescript online, openapi schema to typescript, json schema types, json schema converter.

Tools that pair well with the JSON Schema to TypeScript

  • JSON to Types — Paste an API response and get ready-to-use models in 8 languages: TypeScript, Python (dataclass, TypedDict or Pydantic), Go, Java, C#, Kotlin, Swift and Rust.
  • JSON Formatter — Paste JSON to pretty-print, minify or validate it.
  • JSON5 to JSON Converter — Paste JSON5 or JSON with comments (JSONC, like tsconfig.json or VS Code settings) and get strict, valid JSON.
  • JSONPath Tester — Type a JSONPath query and instantly see what it selects — with the exact path of each match.

Frequently asked questions

How do I convert JSON Schema to TypeScript?
Paste the schema on the left; TypeScript interfaces appear on the right. Definitions in $defs or definitions become named types that $ref points to.
Which JSON Schema versions are supported?
Draft-04 to draft-07 and 2019-09/2020-12 keywords: properties, required, enum, const, items, prefixItems, additionalProperties, oneOf, anyOf, allOf, $ref, $defs and definitions.
Can I use it for OpenAPI schemas?
Yes — paste a single schema, or the whole components.schemas object to get one type per schema. #/components/schemas/ references are resolved.
Is my schema uploaded?
No. Conversion runs entirely in your browser.
Can I install JSON Schema to TypeScript as a web app and use it offline?
Yes. JSON Schema to TypeScript is an installable web app (PWA) — installed from your browser, not downloaded from an app store. Click Install app at the top of this page in Chrome or Edge (Windows, macOS, Linux, ChromeOS) or on Android, use Share → Add to Home Screen on iPhone and iPad, or File → Add to Dock in Safari 17+ on a Mac. It then opens in its own window with its own icon, and because it runs entirely in your browser it keeps working offline. Firefox on desktop can’t install web apps. How installing works.

Related tools