Skip to content
JSON & APIs Runs in your browser — nothing uploadedFree · No signup

JSON to TypeScript Interface Generator

Generate TypeScript interfaces from any JSON sample — nested objects become named interfaces, arrays are typed, and you can switch between interface and type alias output.

JSON input

TypeScript

export interface User {
  id: string;
  email: string;
  age: number;
  roles: string[];
  profile: Profile;
  projects: Project[];
}

export interface Project {
  slug: string;
  stars: number;
  archived?: boolean;
}

export interface Profile {
  avatarUrl: unknown | null;
  bio: string;
}

How to use the JSON to TypeScript

  1. Paste a JSON sample.
  2. Set the root type name and options.
  3. Copy the generated TypeScript into your project.

Features

  • Nested interfaces named from their keys
  • Typed arrays including arrays of objects
  • interface or type alias output; optional export keyword
  • Mark all fields optional for partial API responses

Frequently asked questions

How are mixed-type arrays handled?

Arrays containing different primitive types become union arrays, e.g. (string | number)[].

How are null values typed?

A null value can't reveal its real type, so it is emitted as `unknown | null` — replace it with the correct type once you know it.