Skip to main content

JSON to TypeScript Converter

Paste JSON and instantly get TypeScript interfaces with inferred types.

How it works

  1. 1

    Paste your JSON

    Paste a JSON object or array into the left panel.

  2. 2

    Configure options

    Set the root interface name, toggle export, readonly, or optional markers.

  3. 3

    Copy TypeScript

    Copy the generated TypeScript interfaces from the right panel.

Common use cases

  • Simple object

    {"name": "Alice", "age": 30}

  • Nested object

    {"user": {"id": 1, "roles": ["admin"]}}

About This Tool

Convert any JSON object or array into clean TypeScript interfaces. The converter recursively analyzes your JSON structure, infers types for every field (string, number, boolean, null, arrays, nested objects), and generates properly named interfaces for nested objects.

Options include: custom root interface name, export keyword toggle, readonly properties, and optional (?) markers. Arrays of mixed types produce union types. Nested objects get their own named interfaces (e.g., an "address" field generates an "Address" interface).

Perfect for quickly scaffolding types from API responses, database schemas, or config files. All processing runs in your browser -- nothing is sent to any server.

More examples

Examples

Simple object

Input

{"name": "Alice", "age": 30}

Output

export interface Root {
	name: string;
	age: number;
}

Nested object

Input

{"user": {"id": 1, "roles": ["admin"]}}

Output

export interface User {
	id: number;
	roles: string[];
}

export interface Root {
	user: User;
}
Frequently Asked Questions
How are nested objects handled?
Each nested object gets its own named interface, derived from the field name in PascalCase. For example, a field called "shipping_address" generates a "ShippingAddress" interface.
How are arrays typed?
If all items in an array have the same type, the array is typed as that type (e.g., string[]). If items have mixed types, a union type is generated (e.g., (string | number)[]).
Can I use the output directly in my project?
Yes. The generated TypeScript is valid and can be pasted directly into a .ts file. Toggle export, readonly, and optional modifiers to match your project conventions.
Is my JSON sent to a server?
No. All parsing and type inference happens entirely in your browser. Nothing is transmitted anywhere.

Discover More Tools

View all Developer Tools →