From a JSON sample to interfaces
Each nested object becomes its own named interface, named after the key that holds it. Arrays are typed from all their items, which is where most generators that look only at the first item go wrong:
{ "items": [ { "sku": "A", "qty": 2 }, { "sku": "B", "qty": 1, "backorder": true } ] }
export interface Item {
sku: string;
qty: number;
backorder?: boolean;
}
export interface Root {
items: Item[];
}backorder is optional because one item lacks it. A key whose values have different types becomes a union. The name of the root interface is yours to set in the toolbar.
Limits of inferring types from one sample
The output describes the sample you gave, not the API. A field that happens to be null in the sample is typed null; an empty array is typed unknown[]; a string that is always one of three values is still string. Treat the result as a first draft and tighten it against the API's documentation.
If the sample does not parse, check it in the JSON validator first.