JSON to TypeScript
Generate a TypeScript type from JSON, including nested objects, arrays, unions and fields missing from some sample records.
How to use
Input
Paste valid JSON, enter a root type name, then convert it and save the generated .ts file.
Output
Review the result, then copy it or save the file.
Background
JSON to TypeScript
Types describe only the observed samples. Missing fields in object arrays become optional; an empty array is Array<unknown>. Generated types do not validate data at runtime or replace an API schema.
How input and results are handled
- Input
- Input is processed in your browser.