TypeScript tool

JSON to TypeScript Interface Generator

Paste an API payload or a config file. Nested objects become named interfaces, arrays merge optional keys, and files stay on this device.

Like the tool? Find a bug?Share with us

Generator

Paste JSON. Nested objects become named interfaces. Missing keys in arrays become optional. Files stay on this device.

Supported files: .json
0 / 50,000
TypeScript will appear here.

Guide

How this JSON to TypeScript generator works

01

JSON becomes types

Objects become interface (or type) declarations. Nested objects get PascalCase names from their keys.

02

Runs in your tab

Sample, Nested, and Array are starting points. Parsing stays local — paste a response body and copy types.ts.

03

Optional keys and unions

Array items are merged. A key that appears in only some objects becomes optional. Mixed primitives become a union like string | number.

Use it

What converts well

Objects, nested objects, arrays of objects, primitive arrays, null, and quoted keys that are not valid identifiers. Empty arrays become unknown[]. Invalid JSON shows a parse error. The 50,000 character cap still applies.

FAQ

Questions

Interface or type?

Interface is the default and matches typical API models. Switch to Type for type Name = { … } aliases. Export prefixes declarations; Local omits it.

Why is a field optional?

When you paste an array of objects, this tool unions their shapes. A property missing from some items is marked with ?.

Is my JSON uploaded anywhere?

No. Parsing happens in your browser tab. There is no account and no API call.