Zero Signup ToolsFree browser tools

Converter Tools

JSON Schema to TypeScript Converter

Convert a JSON Schema to TypeScript interfaces in your browser. Handles $ref, $defs, oneOf, anyOf, allOf, enums, tuples, and nullable types.

0 chars

Output options

Declaration style

Indent

Quote style for non-identifier keys

Formatting toggles

How to use

  1. Paste a JSON Schema document into the input on the left, or click Load sample schema to see a worked example with $ref, $defs, enums, formats, and nested objects.
  2. Read the generated TypeScript on the right. Every $defs entry becomes its own named declaration, and nested object schemas are promoted into their own interfaces with PascalCase names derived from the parent property.
  3. Set the root type name, declaration style (interface or type), indent, and quote style to match your codebase conventions.
  4. Toggle Mark fields readonly for immutable models, Sort properties alphabetically for diff-friendly output, or Inline small nested objects when you prefer fewer named interfaces.
  5. Toggle Include TSDoc comments to surface title, description, format, pattern, and min and max constraints in the source, then click Copy types to paste the output into a .ts file.

About this tool

JSON Schema to TypeScript Converter takes an authored JSON Schema (draft 07, 2019-09, or 2020-12) and emits the equivalent TypeScript declarations entirely in your browser. Paste a schema and the converter parses it with the native JSON parser, resolves local $ref pointers against #/$defs/ and #/definitions/, and walks the tree to produce one named interface per object schema. The supported surface area covers what real schemas authored for OpenAPI, AsyncAPI, configuration files, form validation, and message contracts actually use: type (string, number, integer, boolean, null, array, object) including the array-of-types nullable form (type: [string, null]), required and properties, additionalProperties as either false, true, or a sub-schema turned into an index signature, patternProperties merged into the index signature when present, enum collapsed to a union of literal values, const emitted as a single literal, oneOf and anyOf rendered as TypeScript unions, allOf rendered as a TypeScript intersection, items as either a single homogeneous schema or a positional tuple (with the 2020-12 prefixItems plus items rest convention also handled), $ref to a local #/$defs/ or #/definitions/ pointer turned into a named reference so each definition becomes its own top-level declaration, and title plus description rendered as a TSDoc block above the type or property when comments are enabled. Format keywords (date, date-time, email, uri, uuid, ipv4, ipv6) are preserved as TSDoc @format tags because they describe runtime values rather than the TypeScript shape. Output options control the declaration form (interface or type), root name, indent (2 or 4 spaces), quote style for non-identifier keys, the readonly modifier, alphabetical key sorting, whether each declaration is exported, whether nested objects with six or fewer properties stay inline, and whether constraint metadata (pattern, minLength, maxLength, minimum, maximum, example, deprecated) is rendered as TSDoc on the surrounding declaration. External $ref values, schemas that mix incompatible keywords, and unsupported edge cases fall back to unknown with a labelled diagnostic so you can see what to hand-edit. Useful for generating client types from OpenAPI components.schemas, typing webhook payloads, deriving form types from validation schemas, scaffolding API SDKs, and keeping documentation and types in lock-step. Parsing and code generation run locally on your device, so the schema you paste here never leaves your browser.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools