L LocalUse Source

JSON to TypeScript

Paste a JSON response and get clean, named TypeScript interfaces. Every element of an array is merged, so fields that only appear on some records come out optional rather than silently wrong.

Root type name
JSON
Output

Output appears here as you type.

Runs entirely in your browser. Nothing you paste here is uploaded or stored.

Questions

Is my JSON uploaded anywhere?

No. Inference and code generation run entirely in your browser. Nothing is sent to a server, so pasting a real API response with customer data or internal URLs is safe.

Should I paste one object or an array of them?

An array, whenever you have one. Every element is merged into a single shape, so a field that is missing from some records becomes optional and a field that is sometimes null becomes nullable. One object can only ever tell the generator that everything is required.

How are nested types named?

From the key that contains them, in PascalCase, with array keys singularised - a "users" array of objects produces a "User" interface. Structurally identical shapes collapse onto one type instead of generating dozens of duplicates.

Why did a string field become a union of literals?

Because the value looked like an enum: a small set of distinct values, each seen more than once. Turn off "Infer literal unions" to always emit plain string.

More code generation tools