JSON → TypeScript

Generate TypeScript interfaces from a JSON sample.

Runs entirely in your browser

FAQ

What happens with an empty array?
You get unknown[]. There is no sample to infer from — pass a representative item if you need a concrete type.
How does it handle mixed-type arrays?
It emits a union of every distinct item type sorted alphabetically, e.g. (number | string)[]. Objects with different shapes become separate interfaces.
Are keys with dashes safe?
Yes. Keys that aren't valid TypeScript identifiers are emitted as quoted string literals.

Related tools