JSON to TypeScript Converter

Generate TypeScript interfaces from JSON data instantly

Free Online JSON to TypeScript Converter

Paste a JSON payload - an API response, a config object, or a test fixture - and get TypeScript interfaces that match its shape. You do not have to hand-type every field: the converter reads the structure of your data and writes the declarations for you.

  • Nested objects - extracted into their own named interfaces (the example below produces both Root and Specs)
  • Arrays typed from their items - a list of strings becomes string[], a list of objects becomes an interface array
  • Primitives mapped precisely - strings, numbers (integers and decimals), and booleans keep their natural TypeScript types
  • Field names preserved exactly - camelCase, snake_case, and ids come through unchanged, so the types match your payload
  • Drop-in output - plain interface declarations you can paste straight into a .ts file
Open JSON to TypeScript Converter

How to Convert JSON to TypeScript

  1. Open the JSON to TypeScript converter
  2. Paste your JSON into the input editor - a full object works best, since top-level fields become the root interface
  3. Click "Convert" and review the generated interfaces
  4. Copy the output into your TypeScript project and rename Root to your domain type

Example Conversion

Input (JSON):

{
  "id": 101,
  "title": "Wireless Mouse",
  "price": 29.99,
  "inStock": true,
  "tags": ["usb", "ergonomic"],
  "specs": {
    "weightGrams": 98,
    "wireless": true
  }
}

Output (TypeScript Interfaces):

interface Root {
  id: number;
  title: string;
  price: number;
  inStock: boolean;
  tags: string[];
  specs: Specs;
}

interface Specs {
  weightGrams: number;
  wireless: boolean;
}

Common Use Cases

Typing API Responses

Stop guessing at response shapes - generate the interface from a real payload and code against it.

Scaffolding Config Types

Turn a JSON config file into a typed interface so editors catch typos and missing keys.

Documenting Payloads

Generated interfaces double as living documentation of what a webhook or fixture actually contains.

Prototyping Data Models

Draft the type layer of a new feature in seconds, then refine names and optionality by hand.

Related Tools