JSON to TypeScript

Input JSON
1
TypeScript Interfaces
Output appears here…
2sp · 14px · UTF-8

What is a JSON to TypeScript Converter?

A JSON to TypeScript converter reads a JSON object and produces TypeScriptinterface declarations that match the data's exact shape. Instead of manually writing interfaces for every API response, you paste the JSON and get typed interfaces in seconds.

How to Generate TypeScript Interfaces

  1. 1Paste your JSON object or array into the left input panel
  2. 2Click Convert or press Ctrl + Enter
  3. 3TypeScript interfaces appear in the right panel instantly
  4. 4Copy them to use directly in your TypeScript project

Example

Input JSON:

{
  "id": 1,
  "name": "Ravi Mehta",
  "active": true,
  "address": {
    "city": "Surat",
    "zip": "395001"
  },
  "tags": ["developer", "designer"]
}

Generated TypeScript interfaces:

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

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

Features

Nested objects

Each nested object gets its own named interface

Typed arrays

Array element types inferred from the first element

Union types

Mixed-type arrays produce string | number | boolean unions

Optional fields

Null or missing fields are typed as optional (field?: type)

PascalCase names

Interface names follow TypeScript conventions automatically

Zero configuration

No setup, no npm install — paste JSON and get interfaces

Common Use Cases

API responsesType your REST or GraphQL API responses without writing interfaces by hand
Config filesGenerate types for JSON config files used in Node.js or Deno projects
Database modelsConvert MongoDB or Firestore document shapes to TypeScript types
Mocking & testingCreate typed test fixtures from real API response samples

Related Tools

Frequently Asked Questions

Yes. All conversion happens in your browser using JavaScript. Your JSON is never sent to our servers.

The generated interfaces are standard TypeScript and work with any version from TypeScript 2.0 onwards.

Yes. Each nested object gets its own interface. The nesting depth is unlimited.

If an array contains multiple value types (e.g. strings and numbers), the converter produces a union type like string | number.