Results are provided for informational purposes only and may contain errors. Please verify important information independently. Use of this tool is at your own risk.
What the JSON to TypeScript Converter does
The JSON to TypeScript Converter reads a sample JSON object and generates matching TypeScript interfaces. Each nested object gets its own named interface, and each property gets a type inferred from its value: string, number, boolean, null, an array type, or another interface.
Set the interface name in the Interface name field. If the JSON is an array, the types come from its first element, and a list type such as type UserList = User[]; is added.
When to use it
- Typing the response of an API you call from a TypeScript frontend or Node.js service.
- Starting a data model from a real payload instead of writing interfaces by hand.
- Documenting the shape of a webhook or event payload for your team.
Worked example
Input
{"id": 1, "name": "Ana", "active": true, "address": {"city": "Lisbon"}, "tags": ["admin"]}
Output
interface Address {
city: string;
}
interface User {
id: number;
name: string;
active: boolean;
address: Address;
tags: string[];
}Common questions about the JSON to TypeScript Converter
Are optional properties detected?
No. The types are inferred from one sample, so a property missing from that sample is missing from the interface. Add ? to properties that are not always present.
What type does null get?
A value that is null in the sample gets the type null. Change it to a union such as string | null if the field can hold a value.
What happens with arrays of mixed values?
The element type becomes a union, for example (string | number)[]. An empty array becomes unknown[], because there is nothing to infer from.
Is this tool free?
Yes, it's free to use. No signup, no email required. Get results on this page.
How do I get my result?
Use the tool on this page. Your result appears here; no email delivery is required.