JSON to TypeScript
Generate TypeScript interfaces or type aliases from JSON data. Infers nested types automatically.
About JSON to TypeScript
Paste any JSON and instantly generate TypeScript interfaces or type aliases. Nested objects become separate named types, arrays are inferred with proper element types, and unions are created for mixed arrays. Customize the root name, choose interface vs type syntax, and toggle optional properties.
Features
- Generate interfaces or type aliases from JSON
- Infer nested object types with PascalCase names
- Array element type inference with union support
- Configurable root type name
- Optional properties toggle
- Export keyword toggle
- Download as .ts file
- 100% client-side — nothing is uploaded
How to use
- 1Paste JSON into the input panel.
- 2Set the root type name and style preferences.
- 3Click Generate to create TypeScript types.
- 4Copy the result or download as a .ts file.
Frequently Asked Questions
Does it handle nested objects?
Yes. Each nested object becomes a separate named interface (or type alias) with a PascalCase name derived from the key.
How are arrays typed?
The generator inspects all items in an array to infer the element type. Mixed arrays produce a union type.
Can I use type aliases instead of interfaces?
Yes. Switch the Style dropdown from interface to type to generate type aliases instead.
Is my JSON sent to a server?
No. Type generation runs entirely in your browser. Nothing is uploaded or stored.
Related Converters
- JSON to YAMLConvert JSON to clean YAML instantly.
- YAML to JSONConvert YAML to formatted JSON instantly.
- JSON to CSVConvert JSON arrays to CSV or TSV.
- CSV to JSONConvert CSV or TSV to a JSON array.