Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>JSON to TS TypeNew to Visual Studio Code? Get it now.
JSON to TS Type

JSON to TS Type

Abdul Owhab

|
3 installs
| (0) | Free
Generate Typescript Type and Interface from JSON
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSON to TS Type

Generate TypeScript interfaces or types instantly from JSON / API responses — right inside VS Code.

Install from VS Code Marketplace

✨ Features

  • 🚀 Convert selected JSON or clipboard content into TypeScript types/interfaces
  • 🔁 Supports nested objects and arrays
  • 🔎 Automatically detects and reuses duplicate object shapes
  • ⚡ Choice between interface and type output
  • 🧩 Works with REST/GraphQL API responses, mock data, or any JSON

Example:

{
  "id": 1,
  "name": "John",
  "address": {
    "city": "NY",
    "zip": 12345
  },
  "orders": [
    { "orderId": 1, "amount": 200 },
    { "orderId": 2, "amount": 150 }
  ]
}

➡ Generates:

interface Root {
  id: number;
  name: string;
  address: Address;
  orders: Order[];
}

interface Address {
  city: string;
  zip: number;
}

interface Order {
  orderId: number;
  amount: number;
}

If you choose type instead:

type Root = {
  id: number;
  name: string;
  address: Address;
  orders: Order[];
};

type Address = {
  city: string;
  zip: number;
};

type Order = {
  orderId: number;
  amount: number;
};

🛠️ Usage

  1. Copy or select JSON text in your editor.
  2. Right-click → Generate Type/Interface from JSON
  3. Choose whether to output as interface or type.
  4. The generated code is inserted into your file.

⚙️ Commands

Command Description
Generate Type/Interface from JSON Converts JSON into TypeScript models

⚡ Requirements

  • VS Code 1.90.0 or later
  • Works in TypeScript and JavaScript projects

🧑‍💻 Contributing

Pull requests and feature suggestions are welcome!


📄 License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft