What does this tool do?
JSON to TypeScript turns any JSON you paste into clean, ready-to-use TypeScript interfaces. It creates separate interfaces for nested objects, infers array element types, and lets you name the root interface yourself. It is perfect for developers who want to type API responses without hand-writing every interface.
How to use it
- Paste or type your data into the left field.
- The result is generated instantly on the right.
- Use the Copy button to grab the output.
How nested objects are handled
Every object inside your JSON becomes its own interface. A settings field inside a user object, for example, is extracted into a dedicated interface named from the key, such as UserSettings. Array types are inferred from the first element and written as string[] or Tag[], while empty arrays become unknown[]. Keys that are not valid TypeScript identifiers are automatically wrapped in quotes, so the generated code always compiles cleanly without manual fixes.
Rename the root interface
The Interface name field at the top controls the name of the outermost type and defaults to Root. Change it to something meaningful like User, ApiResponse, or Product, and the nested interface names are derived from that root automatically. This makes it easy to paste the generated types straight into your project and match your naming conventions. Everything runs in your browser, so your JSON never leaves your device.
Frequently asked questions
Are integers and decimals typed differently?
No. Both integers and decimals are represented with number, TypeScript's single numeric type, since the language does not distinguish int from float.
How are null values handled?
A field that is null in the JSON is typed as null in the output. In real projects you often want to widen these to union types like string | null by hand.
Does it create interfaces for objects inside arrays?
Yes. If the first array element is an object, an interface is generated from it and the array is typed as an array of that interface, for example Item[].
Is JSON to TypeScript free?
Yes. JSON to TypeScript and all 300+ tools on MagmaNex are completely free with no signup or account required.
Is my data safe?
Yes. Everything runs locally in your browser. The data you enter is never sent to a server, stored, or shared.
Does it work on mobile?
Yes. JSON to TypeScript works on phones, tablets and desktops — no app download needed.
🔒 Privacy: everything runs in your browser, your data is never sent to a server.
