JSON to TypeScript interfaces
Generates TypeScript interfaces from a JSON sample, with optional fields and unions.
Runs in your browser – your file is never uploaded
Frequently asked questions
Is my file uploaded?
No. The conversion runs entirely in your browser. The file never leaves your device – there is no server that could see it. Once the page has loaded, the tool even works offline.
How are arrays with different objects handled?
All elements of an array are merged into one interface. A key that only some elements have becomes optional (“name?: string”); a key with different types becomes a union (“id: number | string”). The element type is named after the property in singular: “users” gives “User”.
What is the Record<string, T> option?
JSON often contains maps keyed by data, for example {"2026-08-24": {…}, "2026-08-25": {…}}. One interface field per date would be useless, so such objects become Record<string, T> when the option is on. Switch it off to always get interfaces.
Why does the output contain “unknown”?
An empty array or a value that is only ever null carries no type information, so the generator writes unknown[] or null. Replace it by hand once you know what the field holds – the rest of the code is ready to use.
Related tools
Format JSON
Pretty-prints JSON with 2 or 4 spaces or tabs and optionally sorts the keys.
● In your browser
Minify JSON
Removes all whitespace from JSON so it takes as little space as possible.
● In your browser
Convert CSV to JSON
Turns a CSV table into a JSON array, with automatic separator detection.
● In your browser
Convert JSON to CSV
Turns a JSON array of objects into a CSV table for Excel and spreadsheets.
● In your browser