JSON to TypeScript

Paste a JSON sample, such as an API response, and get TypeScript interfaces you can copy. Arrays of objects are merged, so a field missing from some items is marked optional. Nothing is sent anywhere.

Runs in your browser. Nothing you type is uploaded.

Your numbers

Result

Generated3 interfaces

2 fields are optional because some items do not have them.

TypeScript
export interface Product {
  id: number;
  name: string;
  tags: string[];
  owner: Owner;
  plans: Plan[];
  archived: boolean;
}

export interface Owner {
  id: number;
  email: string;
}

export interface Plan {
  name: string;
  price: number | null;
  trialDays?: number;
  seats?: number;
}

How it works

Reading the sample
Each value becomes a type: text is string, numbers are number, true and false are boolean. Objects become their own interface, named from the key in PascalCase.
Arrays
All items in an array are merged into one shape. If a key appears in only some items it gets a question mark. If a key holds different kinds of values, you get a union such as number | null.
Limits
Types come from one sample, so they only know what the sample shows. Check fields that can be missing or null in real data. Everything runs in your browser.

Questions

Why is a field marked optional?

It was missing from at least one item in an array. If it is always present in real data, remove the question mark.

Should I use interface or type?

Both work for object shapes. Interfaces can be extended and merged, which suits API responses. Types are needed for unions, so the root becomes a type when the JSON is an array or a plain value.

Is my JSON uploaded?

No. The conversion runs in your browser and the sample never leaves your device.

Get CapyLaunch Weekly

New indie launches and the week in AI tools and models, every Monday. Free, and you can unsubscribe anytime.

We send a confirm link first. Privacy

Your launch, this week. Free.

A reviewed listing, a permanent page with a link to your site, and feedback from makers who actually care.

Start my launch →or browse toolsFree to submit. Every listing is reviewed before it goes live.