JSON to TypeScript

Paste JSON to generate TypeScript interfaces. Auto-generates as you type.

JSON Input
TypeScript Output

Get the JSON & API Cheat Sheet

Formatting tricks, jq commands, and common patterns — one page, zero fluff.

How to Generate TypeScript Interfaces from JSON

Manually writing TypeScript interfaces for API responses is tedious and error-prone. This JSON to TypeScript generator infers types from your JSON data automatically — handling nested objects, arrays, nullable fields, and optional properties. Paste a JSON response and get production-ready TypeScript interfaces instantly.

The inference engine handles edge cases that simpler tools miss: arrays of objects are merged into a single interface with optional fields for keys that don't appear in every item, null values produce union types (string | null), and deeply nested structures generate separate named interfaces rather than inline types.

Toggle between interface and type syntax depending on your project conventions. Enable export for module-ready types, or readonly for immutable data structures. The root interface name is configurable — change it from "Root" to match your domain model.

Tips

  • Paste a real API response rather than writing JSON by hand — the generator handles the exact shape your code needs to work with.
  • For APIs that return arrays at the top level, the generator creates a type alias for the array and a separate interface for the item shape.
  • Use the readonly option for data that comes from APIs and shouldn't be mutated in your frontend state.
  • If your JSON has fields that are sometimes missing, wrap multiple response examples in an array — the generator will detect optional fields automatically.