JSON → TypeScript

JSON input
Loading editor...
TypeScript outputLive
Loading editor...
// Generated TypeScript code will appear here...

What is JSON → TypeScript?

Automatically generate TypeScript interfaces from your JSON data. Paste any JSON object and get properly typed TypeScript definitions.

Nested objects become their own interfaces, with each field typed from the sample value. Output updates as you type, and everything runs in your browser.

Features

  • Generate TypeScript interfaces from JSON
  • Automatic nested type generation
  • Handles arrays, unions, and optional properties
  • Interfaces only, or with Convert helpers that check JSON at runtime
  • Copy generated types to clipboard
  • Client-side processing — your data stays private

How to use JSON → TypeScript

  1. Paste your JSON. Enter a sample JSON object representing your data structure.
  2. Generate TypeScript. The tool instantly produces matching TypeScript interfaces.
  3. Copy and use. Copy the generated types and paste them into your TypeScript project.

Examples

Generating TypeScript interfaces

A small user record with a nested address, generated with the default settings. Trimmed to the generated types. The default output also includes a Convert class and runtime type-checking helpers (about 180 more lines); choose 'Interfaces only' in Settings to leave them out.

Input

{
  "id": 1,
  "name": "Ada Lovelace",
  "email": "ada@example.com",
  "active": true,
  "tags": ["admin", "dev"],
  "address": { "city": "London", "zip": "EC1A" }
}

Output

export interface Root {
    id:      number;
    name:    string;
    email:   string;
    active:  boolean;
    tags:    string[];
    address: Address;
}

export interface Address {
    city: string;

Frequently asked questions

How does JSON to TypeScript conversion work?

The tool analyzes your JSON structure — keys, value types, nested objects, arrays — and generates corresponding TypeScript interfaces.

Can it handle nested objects?

Yes. Deeply nested structures are converted into separate TypeScript interfaces for each level.

Guides