JSON to TypeScriptPaste JSON to generate TypeScript interfaces.
JSON Input

JSON to TypeScript Converter — Free Online Type Generator

Convert any JSON payload into clean, type-safe TypeScript interfaces and types instantly. Generate strongly-typed contracts for REST and GraphQL API responses without manual typing, 100% inside your browser.

Why generate TypeScript types from JSON?

Writing TypeScript interfaces by hand for complex API payloads is tedious and prone to typos. A single misnamed field or wrong primitive type can introduce subtle runtime bugs. This tool parses your JSON object, inspects nested arrays and structures, and generates strongly-typed interfaces in seconds.

Features

Frequently asked questions

How does this JSON to TypeScript converter work?

Paste your raw JSON payload on the left. The tool analyzes all keys, values, nested objects and array elements locally in your browser, generating idiomatic TypeScript interfaces with proper type inference for primitives, unions and nested data structures.

Can it handle nested JSON objects and arrays?

Yes. Deeply nested objects are recursively extracted into dedicated named interfaces, while arrays with heterogeneous elements are typed as union arrays (e.g. (string | number)[]).

Is my JSON uploaded to any server?

No. Type inference and code generation run 100% locally in your browser using JavaScript. No data is sent over the network, making it completely safe for proprietary APIs and sensitive data.

Can I download the generated types as a .d.ts declaration file?

Yes. Click the "Download .d.ts" button to export the entire type definition directly to your computer.

Scroll back up and paste your JSON — your TypeScript interfaces appear instantly.