svg2all

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

Loading tool …

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.