Skip to content

JSON to TypeScript

Paste an API response and get the interfaces ready to use. Nested objects get their own named interface derived from the key, rather than an unreadable inline type, and arrays of heterogeneous objects produce a union instead of picking the first item and lying about it.

# processed in your browser. your content never leaves.

How it works

Inference walks the tree and unifies the types seen per key. If the same key is a string in one item and a number in another, the result is a union rather than an arbitrary pick. A single-item sample yields an optimistic type — pasting several items improves the result considerably.

  • A named interface per nested object, instead of inline types
  • A field missing from some array items becomes optional
  • Choose between interface and type, and readonly or mutable
  • null and undefined treated distinctly, not collapsed into any

Related tools

See all tools →