Developer Tools

JSON to TypeScript

Generate TypeScript interfaces from a sample JSON object, instantly inside your browser.

Private by default Instant results No signup
JSON to TypeScriptLive
Overview

What does this tool generate?

Paste a sample JSON object — like an API response — and this tool infers its shape and generates matching TypeScript interface definitions, saving you from hand-writing types for every field. Nested objects and arrays of objects each get their own named interface, referenced from their parent.

Guide

How to use it

1Paste a sample JSON object
2Set a name for the root interface
3Review the generated interfaces
4Copy them into your TypeScript project

How the type inference works

Each object in the JSON becomes its own named interface — nested objects are named after their parent key and pulled out as separate interfaces, while arrays are typed based on their first element. Primitive values map to string, number, or boolean, and null values are typed as null. Since this is inferred from one example, fields that could hold multiple types (like a number sometimes being null) won't be reflected as a union unless present in the sample.

Why it helps

Features & benefits

Generates separate interfaces for nested objects
Infers array item types from the first element
Customizable root interface name
Live results as you edit the JSON
100% private — nothing leaves the device

Why this runs entirely in your browser

Generation runs in JavaScript locally in the tab, which means it keeps working offline once the page has loaded and nothing pasted here is ever sent to a server.

Common uses

Quickly scaffolding types for an API response you're integrating with, saving time hand-writing interfaces for a large nested object, or generating a starting point to refine into more precise types.

Frequently asked questions

A few things people usually want to know before trusting the numbers.

Yes — nested objects become their own named interfaces, and arrays are typed based on their first element, including arrays of objects.

Since types are inferred from a single sample, only the type present in your example is used. You may need to manually adjust fields that vary across different responses (like adding | null).

Nested object interfaces are named after their parent property key, converted to PascalCase, with numeric suffixes added if the same name would otherwise be reused for a differently-shaped object.

Yes — pasting a JSON array at the top level generates an interface for its item type.

No. All generation happens locally in your browser. Nothing pasted here is sent to a server, stored, or shared.