JSON → TypeScript

FreePrivateInstant

Paste any JSON object and get accurate TypeScript interface definitions in one click. including nested types.

JSON Input
Generated TypeScript
Ctrl+Enter Generate

JSON to TypeScript Interface Generator

Turn any JSON object into TypeScript interfaces instantly. Paste an API response or data shape and get accurate, ready-to-use type definitions, including nested objects, in one click.

Why This Matters

Strong Typing
Catch shape mistakes before runtime. Pair generated interfaces with contracts from JSON Schema and validate payloads using the JSON Formatter.
Safer APIs
Document the exact response shape your mobile and web clients rely on. When APIs drift, compare versions with JSON Diff and re-run this generator.
Better DX
IDE autocomplete loves explicit interfaces. Start from cleaned samples via the JSON Cleaner, then explore nested data with the JSONPath tester.

How to Use

  1. Paste your JSON into the input panel
  2. Set a root interface name (default: Root)
  3. Click Generate or press Ctrl+Enter
  4. Copy or download the .ts file

Example

Input JSON
{
  "name": "Alice",
  "age": 30,
  "address": { "city": "London" }
}
Generated TypeScript
export interface Root {
  name: string;
  age: number;
  address: Address;
}
export interface Address {
  city: string;
}

Features

  • Infers string, number, boolean, null, and arrays
  • Generates named nested interfaces for nested objects
  • Union types for heterogeneous arrays
  • Customisable root interface name
  • Download as .ts file
  • 100% private; no server, no upload

Frequently Asked Questions

Does it handle nested objects?

Yes. Nested objects generate separate named interfaces that reference each other, mirroring the actual JSON structure precisely.

What TypeScript types does it infer?

It infers string, number, boolean, null, arrays, and nested interfaces. Arrays with mixed types generate union types like (string | number)[].

Can I customise the root interface name?

Yes. Set the "Root name" field in the toolbar to any valid TypeScript identifier before generating.

Related Tools