Data Format Conversions
JSON to TypeScript Interface Generator
Workspace
Options
How to use this tool
- 1Paste a sample JSON response or open a .json file.
- 2Name the root type and choose interfaces or type aliases.
- 3Review the generated types; optional fields end in ?.
- 4Copy them or download a .ts file.
Frequently asked questions
After their key in PascalCase, singular for array items: a "users" array of objects becomes User[]. Objects with an identical shape share one type.
When an array holds several objects, the tool merges them. A key missing from at least one item is optional; a key that is sometimes null gets "| null".
They are exact for the sample you paste. Real data may hold other values (for example a number that is sometimes a string), so review fields that come from user input.
No. The conversion runs in your browser with JavaScript. Your file or pasted text is not uploaded, logged or stored by MuhammadLab.
Related tools
JSON to JavaScript Object Converter
Turn JSON into a JavaScript object literal with unquoted keys, your quote style and an export wrapper.
JSON to Python Converter
Convert JSON to a Python dict literal, or generate dataclasses, TypedDicts or Pydantic models from it.
JavaScript to TypeScript Converter
Start migrating JavaScript to TypeScript: JSDoc becomes annotations, class fields are declared and require becomes import.
JSON Formatter
Beautify JSON with stable indentation and optional key sorting.