Skip to content

JSON to TypeScript Types Converter

Instantly convert JSON data to accurate TypeScript interfaces and types with advanced customization options

Updated

What is the JSON to TypeScript Types Converter?

How it works

Examples

Simple User Object

{"id": 1, "name": "John Doe", "email": "john@example.com", "isActive": true, "age": 30}
export interface User {
  id: number;
  name: string;
  email: string;
  isActive: boolean;
  age: number;
}

Nested Objects and Arrays

{"user": {"id": 1, "profile": {"name": "John", "age": 30}}, "tags": ["developer", "typescript"], "scores": [95, 87, 92]}
export interface Profile {
  name: string;
  age: number;
}

export interface User {
  id: number;
  profile: Profile;
}

export type Tag = string;

export type Score = number;

Enum Detection

{"status": ["active", "inactive", "pending"], "priority": ["low", "medium", "high"]}
enum Status {
  active, inactive, pending
}

enum Priority {
  low, medium, high
}

Complex API Response

{"data": {"users": [{"id": 1, "name": "Alice", "email": "alice@example.com", "role": "admin"}, {"id": 2, "name": "Bob", "email": "bob@example.com", "role": "user"}], "total": 2, "page": 1}, "success": true, "message": null}
export interface User {
  id: number;
  name: string;
  email: string;
  role: string;
}

export interface Data {
  users: User[];
  total: number;
  page: number;
}

export interface ApiResponse {
  data: Data;
  success: boolean;
  message: null;
}

Frequently asked questions