Generate TypeScript types from JSON
Paste a sample response and get interfaces you can drop into a project. Nested objects get their own named types rather than being inlined, and an array of objects is merged into one shape with keys missing from some elements marked optional. The inference rules are printed on the page, because guessing why a property came out optional is worse than being told.
This tool runs entirely on your device. Nothing you type here is uploaded, logged or stored.
Settings
0 characters
or paste above
Result
Enter some text above to see the result.
How types are inferred: null becomes null; a key missing from some elements of an array becomes optional; an empty array becomes unknown[]; an array of mixed types becomes a union.