You get a new API response. It has 40 fields, three nested objects, and an array of something you can't quite identify. So you do what we all do: start typing an interface by hand, guessing types as you go.

Twenty minutes later, TypeScript is screaming at you because user_id was a string in one response and a number in another. There is a better way.

🛠️ Free Tool: JSON to TypeScript Converter — WebToolsHub — paste any JSON, get clean TypeScript interfaces instantly. Runs 100% in your browser, nothing is uploaded.

Why Hand-Written Interfaces Go Wrong

Hand-typing types from JSON fails in predictable ways:

  • You miss optional fields. A field that appears in 9 of 10 responses gets typed as required.
  • You guess number vs string wrong. APIs are inconsistent; your eyes at 2 AM are worse.
  • Nested arrays blur together. Is it items: Item[] or items: Item[][]? Squinting is not a strategy.
  • You stop updating them. The API changes, the interface doesn't, and the bug ships.

The Workflow That Actually Works

  1. Grab a real response — from your network tab, logs, or the API docs' example.
  2. If the API paginates or varies, grab two or three samples and merge the keys mentally (or test the edge-case one).
  3. Paste the JSON into the JSON to TS converter.
  4. Review the generated interfaces, rename the root type to something meaningful, and paste into your project.

You go from raw JSON:

{ "id": 1042, "name": "Pro Plan", "price": 29.99, "features": ["api", "sso"], "limits": { "seats": 25, "storage_gb": 100 } } 

To typed code:

interface Root { id: number; name: string; price: number; features: string[]; limits: Limits; } interface Limits { seats: number; storage_gb: number; } 

In seconds, not twenty minutes — and the types match the data because they came from the data.

One Honest Warning

A generator infers types from the sample you give it. If your sample has "discount": null, you'll get null — the real type is probably number | null. Always skim the output for nullable and optional fields before committing. Generation gets you 95% there; your judgment does the last 5%.

Stop typing interfaces by hand. Your future self, debugging at 2 AM, says thanks.