JSON TO TYPESCRIPT CONVERTER
Turn any JSON into clean TypeScript interfaces. Nothing leaves your browser.
interface RootAddress {
city: string;
zip: string;
}
interface Root {
id: number;
name: string;
active: boolean;
tags: string[];
address: RootAddress;
scores: number[];
}How to use the JSON to TypeScript converter
- 1
Paste a JSON object or array.
- 2
Optionally rename the root interface.
- 3
Read the generated TypeScript interfaces, including any nested objects as their own interfaces.
- 4
Copy the result straight into your .ts or .d.ts file.
Questions
- How are nested objects handled?
- Each nested object gets its own named interface derived from the property's key (converted to PascalCase), and the parent interface references it by name — so you get a clean set of separate, reusable interfaces instead of one deeply inlined type.
- What happens with arrays of objects that have different fields?
- The converter merges the fields seen across all objects in the array into a single interface, so every field that appears in any item is represented. It doesn't currently mark fields as optional based on which items are missing them — review the output if your array items vary a lot.
- What type does `null` get?
- A JSON `null` becomes the TypeScript `null` type. If a field is sometimes a value and sometimes null across different objects, you may want to manually union it with the other type it takes.
- Is my JSON sent anywhere?
- No. The conversion runs locally in your browser with JavaScript — nothing is transmitted or stored.