JSON to TypeScript

Generate TypeScript interfaces from sample JSON. Paste JSON and click Run to produce an exportable type definition.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about JSON

How to Convert JSON to TypeScript

JSON to TypeScript

When to Generate TypeScript from JSON

Bootstrap API response types, config interfaces, or fixture types from sample JSON. Faster than hand-writing interfaces for nested structures.

How Inference Works

Types are inferred from the sample values in your JSON. Optional fields, unions, and nullable properties require representative samples — a single object may mark all keys as required.

Common Mistakes

  • Using one sample when fields are optional in the real API
  • Expecting discriminated unions from heterogeneous arrays
  • Keys with special characters — they are quoted in the output interface

Frequently asked questions

Are all properties required?

Yes, based on the sample JSON. If a field is missing from the sample, it will not appear in the interface.

Can I customize the root type name?

Yes. Set the Root type name in Tool Settings before running.