JSON to TypeScript
Paste a sample JSON object or array to generate matching TypeScript interfaces. Nested objects become their own named interfaces.
Advertisement
How to use it
Paste a representative JSON sample and click Generate. Types are inferred from the single sample provided — if a field can be null in some responses and a string in others, the generated type reflects only what's present in your sample.
Frequently Asked Questions
What if an array has mixed types?
The generated type is a union of every distinct element type observed, e.g. (string | number)[].
What if an array is empty?
There's nothing to infer from, so it's typed as any[] — you'll likely want to replace that manually.