Json Web Viewer
All tools

JSON to TypeScript — generate a TypeScript interface online

Have a JSON response, config file, or API payload and want a proper TypeScript type for it instead of typing any? Generate a real interface in one click, entirely in your browser.

Json Web Viewer's Types mode reads your document's actual shape — property names, nesting, array element types, whether a value is ever null — and generates a matching TypeScript interface, ready to paste into your codebase. No server round-trip, no account, no upload.

The same engine also generates Go structs, Rust structs, Python dataclasses, Java records, C# records, and Kotlin data classes from the exact same document — switch languages from the dropdown next to the mode buttons rather than re-pasting your JSON into a different tool for each target language.

Example — this JSON:

{
  "id": "ord_9f21a",
  "customer": {
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "vip": true
  },
  "items": [
    { "sku": "book-001", "qty": 2, "price": 19.99 },
    { "sku": "mug-014", "qty": 1, "price": 12.5 }
  ],
  "shippedAt": null
}

generates this TypeScript:

interface Root {
  id: string;
  customer: Customer;
  items: Item[];
  shippedAt: null;
}

interface Customer {
  name: string;
  email: string;
  vip: boolean;
}

interface Item {
  sku: string;
  qty: number;
  price: number;
}

Open this example in the editor →
The link above pre-loads the order example above into Types mode. TypeScript is the default — select Go or Rust from the language dropdown to regenerate the same document in either of those instead.

Frequently asked questions

Does generating a TypeScript interface upload my JSON anywhere?

No. Type generation runs entirely in your browser — your JSON never leaves the page.

Can I generate other languages instead of TypeScript?

Yes. Types mode has a language dropdown next to the mode buttons — select Go, Rust, Python, Java, C#, or Kotlin from it and the same document regenerates in that language. TypeScript is just the default.

How does it handle arrays, nested objects, and optional fields?

Nested objects become nested interfaces, arrays become typed array properties, and a field that's null in the sample or missing from some array elements is generated as optional/nullable rather than forcing a type that doesn't match the real data.

Need to check your JSON's shape against a formal schema instead of a language type? See JSON Schema Generator.