JSON to TypeScript Type

Generate TypeScript type aliases from JSON.

Free · Runs in your browser · Your text is never uploaded

A JSON object converted into a TypeScript interface

type or interface

Type aliases can describe unions and intersections and cannot be merged; interfaces can be extended and merged. For plain data shapes both work, and many teams choose one style for consistency.

Nested structures

Nested objects are lifted into their own named types so the output stays readable instead of one deep inline shape.

Readonly

Tick the readonly option to mark every property readonly, which suits data you should not mutate.

Types from sample data

The generator infers a TypeScript type from your sample, so fields that are missing in the sample cannot be detected. Check optional properties, unions (a field that can be a string or null) and dates, which JSON delivers as strings. Read generate TypeScript types from JSON.

Need more options? Open the full JSON to TypeScript Converter.

Related guides

Frequently asked questions

Which is better, type or interface?

Either works for data. Use whichever your project already uses.

Does it add export?

Yes, by default. Untick it for local types.