JSON to TypeScript

LocalRuns in your browser; files and input stay on this deviceFreeFree to use

Paste any JSON and instantly get typed TypeScript interfaces. Nested objects and arrays become named, reusable types.

JSON input
TypeScript interfaces
Runs in your browser; files and input stay on this device

About JSON to TypeScript

This tool infers TypeScript interfaces from a sample JSON payload — the fastest way to type an API response you just received. It walks the structure, generates a named interface for every nested object, infers array element types (unioning mixed items), and marks null fields as optional. Everything runs client-side, so your data stays private, and you can paste the result straight into your codebase.

How to use JSON to TypeScript Converter

  1. 1Paste a representative JSON object or array.
  2. 2Set the name for the root TypeScript interface.
  3. 3Review the inferred nested interfaces and copy the generated code.

Frequently asked questions

How are array types inferred?
The generator examines the sample elements. Mixed primitive values can produce a union, while nested objects become named interfaces.
Does one JSON sample describe every possible API response?
No. Types are inferred only from values present in the sample. Add optional fields, broader unions, and domain types after comparing with the API contract.
How are null values handled?
A null sample does not reveal the underlying value type. The generated interface marks that field as optional, so review it against the real schema.