What is JSON to TypeScript?
Converting sample JSON into TypeScript types can speed up API client prototyping. This generator infers primitive, object and array types and creates unions when sample array members differ. Because it uses only a sample, it cannot infer optional properties that were absent from the input or guarantee compatibility with unseen responses.
How to use this tool
- Paste a valid JSON example and choose a legal TypeScript type name.
- Convert to generate a TypeScript export type declaration.
- Copy the declaration or download it as a .ts file.
Example
{"name":"Ada","score":10} → export type GeneratedType = { name: string; score: number; };