JSON to TypeScript

Paste any JSON object or array and instantly get a clean TypeScript interface. Handles nested objects, arrays, nulls, and optional fields automatically.

Used 923 times

Output kind
Export
Null fields
JSON Input
TypeScript Output

Tip: auto-converts on paste  ·  Ctrl+Enter to convert manually

About This Tool

What it does

  • Infers TypeScript types from JSON values
  • Generates separate interfaces for nested objects
  • Merges schemas from arrays of objects — marks fields optional when not present in every element
  • Handles null as optional (field?: Type) or typed (field: Type | null)
  • Outputs interface or type syntax with optional export

Type mapping

  • "hello"string
  • 42 / 3.14number
  • true / falseboolean
  • nullnull or optional field
  • ["a","b"]string[]
  • [{…}] → named interface + TypeName[]
  • [1,"x"](number | string)[]
  • {} → nested interface

Common use cases

  • Typing API responses in React / Next.js apps
  • Generating interfaces from database query results
  • Scaffolding types for new features quickly
  • Converting third-party API docs (JSON samples) to typed models