About the JSON to TypeScript Generator
This free JSON to TypeScript tool generates export interface definitions from sample JSON. Paste an object or array of objects; we infer types (string, number, boolean, null, arrays, nested objects) and output TypeScript you can paste into your project. Useful for API response types, config types, or quick type scaffolding. All processing runs in your browser. See also our JSON formatter, JSON to CSV, and blog for how to generate TypeScript interfaces from JSON online.
When to Use JSON to TypeScript
When you have a JSON response or config and want TypeScript types, writing interfaces by hand is tedious. This generator infers types from the structure: primitives get their literal type, nested objects become separate interfaces (named from keys or Nested0, Item0, etc.), and arrays become Type[]. You can paste the output into a .ts file and tweak names or optionality as needed.
Inferred Types
We infer string, number, boolean, and null. Objects become interfaces; arrays of objects become InterfaceName[]. Empty arrays become unknown[]. Nested object keys are used to name interfaces (e.g. user → User) when possible. For more control, use a dedicated codegen tool or edit the output.
Related Tools
JSON formatter, JSON validator, JSON minifier, JSON diff, JSON to CSV. Blog · FAQ · IP lookup.
FAQ
How do I generate TypeScript interfaces from JSON? Paste your JSON and click Generate TypeScript. Copy or download the interface definitions.
Is this JSON to TypeScript tool free? Yes. No signup; generation runs in your browser.