Skip to content
M2TOOLKIT

Developer · free tool

JSON to TypeScript Interface Generator

Paste a sample JSON response and get TypeScript interfaces for it.

Use it as often as you like — it's free, with no sign-up and no limits.

  • Developer
  • Free
  • No sign-up
  • Runs in your browser
  • Updated
Arrays of objects are merged; keys missing in some items become optional.

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us.

How to use the JSON to TypeScript

  1. Paste a representative JSON sample.
  2. Name the root type.
  3. Copy the generated interfaces into your code.

What does this tool do?

Nested objects get their own named interfaces. For arrays of objects, all items are merged — a key that's missing from some items becomes optional — so the types reflect the real variety in your data.

Generated types are only as good as the sample, so use a response that includes optional fields where possible.

Why use it?

  • Type API responses in seconds.
  • Avoid hand-typing large interfaces.
  • Optional keys detected automatically.

Example

{"id":1,"tags":["a"]} becomes:
export interface Root {
  id: number;
  tags: string[];
}

Privacy

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.

Frequently asked questions

Do generated types check my data at runtime?

No. TypeScript types disappear when your code is compiled, so they can't stop bad data from an API. For runtime checks, use a validation library such as Zod alongside the types.

How do I get better types?

Use a sample that includes every field you expect, ideally several items from an array. A field that's missing from some items becomes optional, so a varied sample gives more accurate types.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the json to typescript.