Text & code · runs locally
JSON to TypeScript interfaces
Paste a JSON payload, get named interfaces back — optional fields included when array elements disagree.
How to use this tool
- 1Paste a real payload
An API response, a config file, a database row — the bigger and messier the sample, the better the inference.
- 2Name the root type
Root and nested interfaces are PascalCased from the name you give (or the key they came from). Pick interface or type-alias style, with or without export.
- 3Copy types.ts
The output is ready to paste into a .ts file — every nested object gets its own declaration.
This page has no server behind it. Files are read, changed and re-built by your own browser — then they disappear when you close the tab. That's the whole privacy policy, applied.
Questions people actually ask
What about optional fields?
When an array’s objects disagree about which keys they carry, keys missing from some elements are marked with ?. If every object has the key, it stays required.
Will it handle arrays of mixed shapes?
Yes. Elements whose types differ produce a union (string | number)[], and arrays of objects are merged into one interface with optional keys.