Generate TypeScript types from any JSON payload.

Paste a response body and get ready-to-use interfaces or type aliases — nested objects and arrays included.

Valid JSON

10 lines · 192 B

input192 B · 10 lines
outputts
export interface Env {
  LOG_LEVEL: string;
  TIMEOUT_MS: number;
}

export interface Deploy {
  service: string;
  region: string;
  replicas: number;
  env: Env;
  health: boolean;
  notes: null;
}

export interface Root {
  deploy: Deploy;
}

# 18 lines · 245 chars

01 · How generation works

From runtime data to compile-time types.

Every nested object becomes its own exported declaration, named after its key in PascalCase. Arrays are inspected element by element, producing a union type when the values differ and unknown[] when the array is empty.

Switch between interface and type alias output with the toggle in the toolbar — the declarations regenerate instantly, and you can copy or download them as a .ts file.

02 · Capabilities

Typed in one paste.

Interface or type

One toggle switches between exported interfaces and type aliases.

Nested declarations

Deep objects become named, reusable declarations — not one giant inline blob.

Union-aware arrays

Mixed arrays collapse to precise unions like (string | number)[].

03 · FAQ

Quick answers.

Interface or type alias — which should I pick?+

Both are generated from the same JSON. Interfaces support declaration merging and extends; type aliases are more flexible for unions. Use the toggle in the toolbar to switch instantly.

How are nested objects handled?+

Every nested object becomes its own exported declaration, named from its key in PascalCase, and the parent field references it by name.

How are arrays typed?+

The converter inspects every element and produces a union when types differ — for example (string | number)[] — and unknown[] for empty arrays.

Is my JSON uploaded anywhere?+

No. Type generation runs entirely in your browser; nothing you paste ever leaves your device.

04 · Related tools

The jsonglow toolkit.