JSON to TypeScript Interface Converter

Paste an API response or any JSON sample and get TypeScript interfaces for it: one interface per object, typed fields and array types, ready to use with fetch, Axios or Angular's HttpClient.

Input Code
Ready - Type or paste code in the left panel
Output Code
Ready - Type or paste code in the left panel

How to convert JSON to TypeScript

  1. Paste your JSON into the left panel, or click Load Sample.
  2. TypeScript is already selected as the output on the right.
  3. Click Convert, then Copy Output.

Example

This JSON:

{ "id": 101, "name": "Ada Lovelace", "email": "ada@example.com", "active": true, "balance": 250.75,
  "address": { "city": "London", "postcode": "N1 9GU" }, "tags": ["admin", "beta"] }

becomes:

interface Address {
    city: string;
    postcode: string;
}

interface RootObject {
    id: number;
    name: string;
    email: string;
    active: boolean;
    balance: number;
    address: Address;
    tags: string[];
}

How JSON types map to TypeScript

JSON valueTypeScript type
"text"string
101 or 250.75number
trueboolean
{ … }a new interface named after the key
["a", "b"]string[]

Interfaces, types or runtime validation?

Interfaces describe the shape of the data for the compiler; they disappear at runtime. That's what most code needs: const user = await res.json() as RootObject;. If the data comes from outside your control and you want to check it at runtime, choose TypeScript (Zod) as the output instead: you get a Zod schema and the matching type from z.infer, so Schema.parse(data) throws on bad input.

Typing an API response

const res = await fetch('/api/users/101');
const user: RootObject = await res.json();
console.log(user.address.city);

With Angular, pass the interface to HttpClient: this.http.get<RootObject>(url).

Things to check after generating

Is my JSON sent anywhere?

Your JSON is sent to our server, converted in memory and returned; it isn't stored. See the privacy policy.

Frequently asked questions

How do I convert JSON to a TypeScript interface?

Paste the JSON on the left, keep TypeScript selected on the right and click Convert. Every object becomes an interface; copy them into a .ts file.

Interface or type alias?

Both work for JSON data. Interfaces can be extended and merged; type aliases can express unions. The generator writes interfaces, which you can change to type aliases by replacing "interface X" with "type X =".

How do I validate the JSON at runtime?

Choose TypeScript (Zod) as the output. You get a Zod schema plus its inferred type, and Schema.parse(data) checks the data when your code runs.

Does it handle nested objects and arrays?

Yes. Nested objects get their own interfaces and arrays become typed arrays such as string[].

Other languages: JSON to Java · JSON to Go · JSON to Python · JSON to C# · JSON to Kotlin · all languages

Share Content

Choose what to share and generate an instant link

🔥 One-time link Content deleted from server after first view
✉️
Uploading to server…