JSON Tool 06

JSON to TypeScript types

Generate TypeScript interfaces or type aliases from JSON, with nested object types, array types and nullable fields ready to paste into your project.

Input Enter JSON structure

Paste the JSON your API returns

Nested objects and arrays become their own types
TypeScript Types will appear here

Types appear here

Press Generate types to build a single .ts module
Every object becomes its own exported type; arrays map to T[] and null fields to “| null”. Client-side only

Frequently asked

Should I choose interface or type?
Either works. The Declaration dropdown emits export interface Name { ... } or export type Name = { ... }; both describe the same shape, so pick whichever your codebase already uses.
How are nested objects and arrays handled?
Every object becomes its own exported type and the parent field references it by name. An array becomes T[], so an array of objects generates the element type and a field such as Project[], and an empty array becomes unknown[].
What happens to null values and unusual key names?
A field whose value is null is typed unknown | null. Keys that are not valid TypeScript identifiers are quoted, for example "user-id": string.
What if two objects have the same shape or the same name?
Identical shapes share a single generated type. When two different objects both derive the same name, the later one gets a numeric suffix such as Meta2, so the output is always valid TypeScript.
Is my JSON uploaded?
No. The types are generated in the page.