Skip to content

JSON to TypeScript

Coming soon

Generate TypeScript interfaces from a JSON sample.

Tell us this tool matters to you. The tools with the most interest are built first.

What is JSON to TypeScript?

This tool reads a JSON sample and writes the TypeScript interfaces that describe it. Nested objects become their own interfaces and arrays get typed elements, so you can type an API response in seconds.

Useful for

  • Typing the response of a REST API you consume.
  • Creating types for a configuration file.
  • Starting a data model from real example data.

How to use

  1. Paste a representative JSON sample.
  2. Set the name of the root interface.
  3. Copy the generated interfaces into your project.

Examples

A user object

Input
{"id":1,"name":"Ada","roles":["admin"]}
Output
interface Root {
  id: number;
  name: string;
  roles: string[];
}

Frequently asked questions

How are null values typed?

A null value becomes a union with null, such as string | null, because a single sample cannot reveal the real type.

Will it generate type aliases instead of interfaces?

Yes, the plan is to let you choose between interface and type declarations.

When will this tool be available?

It is on our roadmap. Click "I want this tool" on this page to tell us it matters to you — the tools with the most interest are built first.

Available now