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

You might also like

JSON Formatter & Validator

Paste JSON to pretty-print, validate, minify, and explore. Click any node in the tree view to copy its JSONPath expression — perfect for building API queries.

cURL to Code Converter

Paste a cURL command and instantly get the equivalent code in Python, JavaScript, Go, PHP, and more. Perfect for converting browser DevTools requests into production code.

Prettier Code Formatter & Colorizer

Reformat and colorize your code using Prettier and react-syntax-highlighter. Easily convert messy code into a clean, readable format with syntax highlighting.

Code Screenshot Generator

Turn any code snippet into a beautiful, shareable screenshot. Choose from popular syntax themes, select your language, adjust padding and background, then export as a high-quality PNG — no Carbon account required.