Data Converters

JSON to TypeScript Interface Generator

Stop writing TypeScript interfaces by hand. Paste any JSON object and get fully-typed TypeScript interfaces with nested types, arrays, and optional fields, ready to paste into your codebase.

Infers interfaces from shape Browser-only Zero dependencies
JSON TypeScript
Paste JSON below, or drop a file
Options

Converted entirely in your browser; your data never leaves your device

Features

  • Generates TypeScript interfaces from any JSON shape
  • Handles nested objects as separate named interfaces
  • Detects array element types including mixed arrays
  • Marks potentially-null fields as optional (?) automatically
  • PascalCase interface names derived from key names
  • Copy result with one click

How to use it

  1. Paste your JSON object or API response into the input.
  2. TypeScript interfaces appear instantly in the output.
  3. Copy the result and paste it into your .ts or .d.ts file.

Use cases

  • Typing API responses from REST or GraphQL endpoints
  • Creating interfaces from JSON config or settings files
  • Bootstrapping type definitions for third-party JSON data
  • Building typed data models from database JSON exports

Limitations

  • The generator infers common primitive, array, and nested object shapes.
  • Very large files depend on browser memory and device performance.
  • Malformed or highly specialized data may need manual cleanup before or after conversion.
Questions & answers

Frequently asked

How are arrays handled?

Arrays are typed by sampling all elements. If all elements are the same type, it uses T[]. Mixed arrays use (TypeA | TypeB)[].

Are nullable fields detected?

Fields that contain null or whose key appears in only some objects in an array become optional (?:) in the interface.