JSON to TypeScript Interface Converter
NEWConvert JSON to TypeScript interfaces or types instantly: nested PascalCase interfaces, optional props from mixed arrays and null unions. Free, in-browser.
Runs 100% in your browser — your input is never uploaded or stored on our servers.
Quick Examples
Typical inputs and the results this tool produces.
Overview
This JSON to TypeScript converter turns a sample API response or config file into ready-to-paste TypeScript interfaces. Nested objects get their own PascalCase interface named after the key, array item types are named in the singular (orders → Order), and identical shapes are reused instead of duplicated.
When an array holds objects with different keys, they are merged into one interface and keys missing from some items become optional. Values that are sometimes null become a "| null" union. You can switch between interface and type aliases, toggle export, mark every property optional, and set the root name.
Conversion happens locally in your browser, so private payloads stay on your machine.
Why use this tool?
- Type an API response in seconds
- Optional props inferred from real samples
- Nested interfaces with clean names
- No upload: JSON stays in your browser
Features
Nested interfaces
Each nested object becomes its own PascalCase interface.
Optional detection
Keys missing from some array items are marked with ?.
Null unions
Fields that are null in some samples become T | null.
Interface or type
Output interface declarations or type aliases, with or without export.
Shape reuse
Objects with the same shape share one interface.
Copy or download
Copy the code or save it as types.ts.
How to Use
Paste JSON
Paste a sample object or array into "JSON sample".
Set the root name
Type a name such as User or ApiResponse in "Root name".
Choose options
Pick interface or type, and toggle export and "All properties optional".
Copy the types
Click Copy or "Download .ts" and add the file to your project.