JSON to TypeScript

Generate TypeScript interfaces from a JSON payload, including nested objects and arrays.

This tool runs entirely in your browser. The file you choose is never uploaded to a server. Free, with no account required.

Input
JSON
Output
TypeScript interfaces
Category
Developer Tools
Status
Available now
Price
Free — no subscription, no account

How to use JSON to TypeScript

  1. Paste a JSON payload - an API response is the usual candidate.
  2. Set the root type name if you want something better than Root.
  3. Copy the generated interfaces or download them as types.ts.

Frequently asked questions

How are arrays handled?

An array of objects becomes one item interface used as an array; mixed element types become an explicit union, and an empty array becomes unknown[].

Why is nothing marked optional?

A key present in the sample is emitted as required. Marking fields optional without seeing the data say so would produce types that lie.

What happens to null?

It becomes an explicit null union member, so the generated type refuses to pretend the value is always a string or number.

Are awkward keys handled?

Yes - keys that are not valid identifiers (order-id, class, 2026-plan) are quoted or prefixed so the output always compiles.

Related tools