JSON → TypeScript Converter
Paste JSON and get clean TypeScript types with unions, optionality, and more.
Settings
Input
paste your JSONOutput
Convert your JSON and the types appear here.
About the JSON → TypeScript Converter
This tool allows developers to take raw JSON objects—like API responses, configuration files, or mock data— and instantly generate clean, strongly typed TypeScript interfaces. Instead of writing types by hand, you can copy and paste JSON and get ready-to-use definitions.
Key Benefits
Example Use Case
Suppose your API returns the following JSON:
[
{ "id": 1, "status": "open", "user": { "name": "Ada" } },
{ "id": 2, "status": "closed", "user": { "name": "Grace", "email": "g@x.dev" } }
]The tool will generate TypeScript types like:
export interface Root extends Array<RootItem> {}
export interface RootItem {
id: number
status: "open" | "closed"
user: User
}
export interface User {
name: string
email?: string
}Notice how email becomes optional (email?: string) because it's not present in every object.
When to Use
- Quickly typing new API endpoints during frontend development
- Generating models for mock data or testing
- Documenting backend responses for better DX
- Refactoring untyped JavaScript projects to TypeScript
FAQ
Does it support arrays at the root?
Yes, root-level arrays are automatically typed as Array<T> with smart inference for their items.
What about deeply nested objects?
Nested objects are expanded into their own interfaces. Identical shapes are de-duplicated where possible to avoid repetition.
Can I use the generated types directly in my project?
Absolutely! Just copy or download the output and drop it into your TypeScript project.