← Back to tools
JSON to TypeScript
Generate TypeScript interfaces or type aliases from JSON data. Handles nested objects, arrays, nulls, and mixed types.
About JSON to TypeScript
- Interfaces vs Types — interfaces are extendable and commonly used for object shapes; type aliases support unions and intersections.
- Nested objects — by default, each nested object gets its own named type. Enable "Inline nested" to embed them directly.
- Arrays — element types are inferred from all items. Mixed-type arrays become union types (e.g.,
(string | number)[]). - Root arrays — if your JSON is an array of objects, all objects are merged to produce a complete type.
- Null values — inferred as
null. Enable "Optional props" to mark all properties with?. - Everything runs in your browser — no data is sent over the network.