Generate TypeScript types from JSON
Infer a TypeScript type from a JSON example.
Input & settings
How to use this tool
Paste your source, choose the supported options, then process. Inspect or download the complete result.
Limits and behavior
One example cannot infer optional properties or every possible value. Empty arrays become unknown[]. Heterogeneous arrays use unions. Maximum total input 1 MB, output 3 MB, JSON nesting 64 levels. Processing stays in your browser worker. Input is limited to 1 MB and output to 3 MB. No input content is saved by CraftAI.
Generate TypeScript types from a JSON example
Paste representative JSON data and infer a TypeScript type definition you can adapt to a project. This JSON-to-TypeScript converter works from examples, not from an application-wide schema.
Will inferred types include fields absent from my JSON sample?
No. Type inference only sees values present in the example. Review optional fields, unions and edge cases manually.
Related tools: Generate JSON Schema · Validate JSON