JSON to TypeScript Interfaces
Turn any JSON object or array into TypeScript interfaces, with nested types, arrays and optional fields handled for you.
Paste JSON above to generate matching TypeScript interfaces.
How it works
Paste a JSON object or array and the tool walks the whole structure and writes matching
TypeScript declarations as you type. Every nested object becomes its own named interface,
arrays become T[], and objects inside an array are merged so that a key which is
missing from some items is marked optional with ? and differing value types
become a union. Identical shapes are emitted once and reused, and keys that are not valid
identifiers are quoted for you.
Rename the root type, switch between interface and type aliases,
choose 2-space, 4-space or tab indentation, add or drop the export keyword, and
optionally turn null values into optional properties. Everything runs in your
browser with the native JSON.parse โ nothing is uploaded, so it is safe for real
API responses. Use Copy TypeScript or Download .ts to take the result into your editor.
Frequently asked questions
How do I convert JSON to a TypeScript interface?
Paste your JSON object or array into the box and the interfaces are generated as you type. Every nested object becomes its own named interface, arrays become T[], and you can rename the root type, switch to type aliases, pick 2-space, 4-space or tab indentation and toggle the export keyword. Then use Copy TypeScript or Download .ts.
How does it handle arrays where some items have extra keys?
Objects inside an array are merged into a single item type. A key that only appears in some elements is marked optional with a question mark, and a key whose value type differs between elements becomes a union such as string | number. Identical shapes are emitted once and reused instead of creating duplicate interfaces.
What happens to null values, empty arrays and odd key names?
A null value is typed as null by default, or you can tick "Make null properties optional" to get an optional property instead. An empty array becomes unknown[] because there is nothing to infer from, an empty object becomes Record<string, unknown>, and keys that are not valid identifiers (like user-id) are quoted automatically.