JSON to TypeScript Interface Generator

Generate clean TypeScript interfaces from JSON in one paste, including nested objects, arrays and optional fields.

Generated code
Runs in your browser. Your JSON is never uploaded.

How to convert JSON to TypeScript interfaces

  1. Paste the JSON you get from an API, a database or a config file.
  2. Name the root type, for example User or ApiResponse.
  3. Copy the interfaces or download them as a .types.ts file.

Nested objects become their own named interfaces, so the result stays readable even for large responses.

What the generator handles

JSON TypeScript
"name": "Aarav" name: string;
"age": 27 age: number;
"tags": ["ai", "seo"] tags: string[];
"items": [1, "a"] items: (number | string)[];
Nested object A separate exported interface
Field missing in some array items An optional field, such as repo?: string;
Field that is sometimes null string | null

Types are not validation

Writing const user: User = await res.json() tells TypeScript to trust the data, but nothing checks it when the code runs. For data from outside your app, such as API responses, form posts and webhooks, generate a Zod schema from the same JSON with the JSON to Zod tool and validate it first.

Frequently asked questions

Interface or type: which one does it output?

Objects become interface declarations because they are easy to extend. A top-level array becomes a type alias, such as export type UserList = User[];.

Is my data safe?

Yes. The generator runs in your browser and never uploads your JSON.

Why is a date typed as string?

JSON stores dates as text, so the parsed value really is a string. Convert it with new Date(value) where you need a Date.

logo

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome content in your inbox.

We don’t spam! Read our privacy policy for more info.

More free tools