JSON to TypeScript
Paste any JSON and instantly get TypeScript interface definitions. Supports nested objects, arrays, and mixed types — perfect for typing API responses.
About JSON to TypeScript
This converter reads any valid JSON and produces TypeScript interface definitions for it. It handles nested objects (by generating separate interfaces), arrays of primitives and objects, and mixed types with union annotations.
Options
- Root interface name — Name of the top-level interface.
- Optional nullable fields — Adds
?to fields whose value isnull. - Export interfaces — Prepends
exportto each interface. - Readonly fields — Marks every field as
readonly.
How to use
- Paste your JSON into the input box on the left.
- (Optional) Change the root interface name and options.
- Click Convert — the TypeScript output appears on the right.
- Click Copy Output and paste into your
.tsfile.
Frequently asked questions
How are arrays of objects handled? Each unique object shape in an array becomes its own interface, and the field is typed as InterfaceName[].
What about mixed-type arrays like [1, "two"]? The converter emits a union: (number | string)[].
Is my data sent anywhere? No — conversion happens entirely in your browser. Nothing is uploaded.