InstrumentsJSON to TypeScript Types
JSON to TypeScript Types
Paste a JSON sample and get TypeScript interfaces for it, with copy and .ts download. The types come from that one sample.
JSON to TypeScript Types
One JSON value. The root can be an object, an array or a primitive.
The name of the top-level type. Letters, digits and underscores.
The types are inferred from this one sample, so they may be too narrow. A field that is sometimes null or missing in other responses is not represented. Check the output against more real data before you rely on it.
export interface Root {
id: number;
name: string;
active: boolean;
}
FAQ
Are the types complete for every response my API can send?
No. The types are inferred from one JSON sample. A field that is sometimes null or missing in other responses is not represented, so compare the output with more examples before you rely on it.
Why does an array of objects become one interface?
Every object in the array is checked for its keys. A key that appears in some items but not all of them is marked optional with a question mark.
Is my JSON sent to a server?
No. The conversion runs in your browser, and the input is not sent anywhere.
Related tutorials
§04Toolbox
Related tools
Personalize your path
Choose your experience level once.
Next Step
Build fundamentals after each tool run so you can apply concepts with confidence.