close
Skip to main content

TypeScript to JSON Schema

Paste a TypeScript interface or type and get a JSON Schema (Draft 2020-12) document back. Runs entirely in your browser — your TypeScript is never uploaded.

What this converter handles

  • interface and top-level type aliases
  • • Primitives: string, number, boolean, null
  • • Optional properties become absent from required
  • • Unions become anyOf
  • • String/number literal unions become enum
  • • Arrays T[] become { type: "array", items: T }
  • Record<string, V> becomes additionalProperties
  • • References to other declared interfaces resolve via $ref

Why JSON Schema?

JSON Schema is the standard for describing JSON document shapes — it's what API gateways, message queues, configuration validators, and AJV use under the hood. Generating schemas from your TypeScript types means you only maintain the type definitions; the runtime guards stay in sync automatically.

For drop-in Zod schemas instead, see the TypeScript → Zod converter.

Related tools