JSON TO TYPESCRIPT CONVERTER
Turn any JSON into clean TypeScript interfaces. Nothing leaves your browser.
In short
Paste any JSON object or array and get matching TypeScript interfaces, with nested objects turned into their own named interfaces. Runs entirely in 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.
Related tools
- UUID GeneratorGenerate random v4 UUIDs, one at a time or in bulk.
- HTML/CSS/JS Beautifier & MinifierBeautify or minify HTML, CSS, and JavaScript instantly in your browser — no upload, no account.
- XML to JSON ConverterConvert XML to JSON or JSON back to XML instantly. Attributes become @-prefixed keys, arrays are handled automatically — nothing uploaded.
- YAML ⇄ JSON ConverterConvert YAML to JSON or JSON to YAML instantly in your browser, with clear error messages when parsing fails.
- CSV ⇄ JSON ConverterConvert CSV to JSON or JSON back to CSV, with correct quoted-field and comma handling — entirely in your browser.
- Curl Command GeneratorBuild a curl command from a method, URL, headers, auth, and body — pick the options you need and copy the result.
- Base ConverterConvert numbers between binary, octal, decimal, hexadecimal, and any custom base from 2 to 36.
- JSON Schema ValidatorValidate JSON data against a JSON Schema and see every failing property with its exact path and reason.
Updated