Typing an API response without writing it by hand
When a TypeScript project reads JSON from an API, the compiler knows nothing about its shape. The value is any, or unknown, and every property access is a guess. Writing interfaces for the response fixes that, but a real payload can have dozens of keys and several nested objects. Typing them by hand is slow, and it is easy to miss a key or get a type wrong. Generating them from a real sample gives you a correct first draft in a second.
This tool walks your sample and writes one interface per object. Names come from the keys: the object under address becomes Address, and the items of a users array become User, because a list of users holds users. Arrays of plain values become string[] or number[]. A list that mixes types becomes a union, such as (string | number)[]. When two objects have exactly the same keys and types, they share one interface instead of producing two copies. When two different shapes would get the same name, the second becomes Item2, so nothing is silently merged.
The most useful part is how arrays of records are read. Real data is not uniform. One order has a coupon and the next does not. One user has an email and another has null. The tool merges every item of an array, so a key missing from any item is marked optional with ?, and a key that is sometimes null gets | null. The more records you paste, the closer the types come to what the API really returns. With one record, everything looks required.
Numbers deserve a note. JSON has one number type, and JSON.parse turns every one into a JavaScript number. So the tool types them all as number, including integers too large for a number to hold exactly. That is honest: it is what your code receives. If the API sends 19-digit IDs, they are already rounded by the time your code sees them, and the fix is for the API to send them as strings.
Treat the result as a draft. Rename interfaces whose names read badly, replace unknown[] for arrays that were empty in the sample, and tighten string to a union of literal values where you know the options. Everything is generated in your browser, so you can paste a production response with real customer data and nothing is sent anywhere.