Developer Tools

JSON to TypeScript Interface Generator

Paste any JSON object and instantly generate TypeScript interface declarations. Handles nested objects, arrays, optional fields (when value is null), and union types, ready to paste into your TypeScript project.

Runs in your browser No data sent to servers Copy or download result
json JSON
Options
Runs in your browser; code never leaves your device

Features

  • Infers TypeScript interfaces from JSON structure
  • Handles nested objects as sub-interfaces
  • Detects arrays and their element types
  • Marks null values as optional (key?: type)
  • Generates interface names from JSON keys
  • Copy TypeScript code with one click
  • Browser-only

How to use it

  1. Paste your JSON object or array into the input panel.
  2. TypeScript interfaces appear in the output instantly.
  3. Rename the root interface if needed.
  4. Copy the TypeScript code and paste into your project.

Use cases

  • Bootstrapping TypeScript types from API responses
  • Generating types from JSON configuration schemas
  • Creating type-safe interfaces for third-party API payloads
  • Adding types to existing untyped JSON data

Limitations

  • Union types (string | number for mixed-type arrays) are detected but complex polymorphic shapes need manual adjustment.
  • The inferred types are based on the provided sample, optional fields not present in the sample won't be marked optional.
Questions & answers

Frequently asked

Does it generate classes or just interfaces?

It generates TypeScript interfaces (type declarations), not classes with constructors.