JSON to TypeScript Interface

Paste a JSON object to automatically generate TypeScript interfaces with nested types.

JSON Input
TypeScript Output
interface Address {
  street: string;
  city: string;
}

interface Root {
  id: number;
  name: string;
  email: string;
  active: boolean;
  score: unknown | null;
  address: Address;
  tags: (string)[];
}

About This Tool

How to Use
  1. Paste your JSON into the left input panel
  2. TypeScript interfaces are generated automatically as you type
  3. Enter a custom root interface name in the field provided
  4. Toggle between interface and type alias output
  5. Enable readonly or optional modifiers as needed
  6. Click Copy to copy the generated TypeScript to your clipboard
Common Use Cases
  • Generating TypeScript types from REST API response payloads
  • Creating interfaces from JSON configuration file structures
  • Scaffolding types from database query result shapes
  • Converting JSON Schema examples into TypeScript definitions
Tips & Tricks
  • Nested objects are extracted into separate named interfaces automatically
  • Arrays with mixed value types generate union types
  • null values produce nullable types (Type | null)
  • Use the optional fields toggle when your API may omit certain keys

Related Tools