Free tools, no sign-up — everything runs in your browser.
ToolHub 1000Free online tools

JSON to TypeScript Converter

Turn a JSON sample into TypeScript interfaces by inferring each value's type.

Quick answer: enter your details below and click Convert — your result appears instantly, right here in your browser. Nothing you enter is uploaded or stored.
J
Developer

Enter your details below.

How to use

  1. Paste your JSON sample into the box.
  2. Click Convert.
  3. Copy the generated interfaces into your TypeScript code and adjust optional fields as needed.

About this tool

Paste a JSON sample and this tool walks through it recursively: objects become interfaces, arrays become element types, and strings, numbers and booleans become their matching types, with nested objects getting their own interfaces. It is a starting point for typing an API response, so check the result against the real data, especially for fields that are sometimes missing or sometimes null. Invalid JSON produces a clear error instead of a guess.

Frequently asked questions

What happens with an empty array?

It becomes unknown[], because an empty array gives no clue about its element type. Replace it once you know what the array holds.

Are nested objects handled?

Yes. Each nested object gets its own interface, named from its field, and the parent refers to it by that name.

Related tools

All tools · Read the guide: JSON to TypeScript Converter