JSON to TypeScript

Paste any JSON object or array and get auto-generated TypeScript interfaces or type aliases.

About this tool

Why Generate TypeScript Types from JSON?

When consuming an API or processing config files, you need TypeScript types that match the data shape. Hand-writing them is slow and error-prone. This tool infers the most precise types it can — including nested objects, mixed arrays as union types, and nullability detection — saving hours of typing.

How are types inferred for arrays?

If all array elements share a structure, the type is Item[]. If elements have different shapes, the result is a union: (A | B)[].

Why is a field marked optional?

Fields appear optional when they're missing in some objects of an array, or when at least one occurrence is null or undefined (depending on your selected mode).

Related Tools

More Dev Tools

Base64 EncoderBcrypt GeneratorColor PickerCron ParserCSS MinifierCSV ⇄ JSON

Want more detail? Read How to Use JSON to TypeScript Converter: Practical Guide and Best Practices.