T-52 · Developer tools
Generate TypeScript interfaces or types from a JSON sample. Nested objects get named interfaces; array items are merged with optional fields.
About this instrument
Paste a JSON response or config sample and get TypeScript declarations for it. Nested objects become named interfaces (from their key, in PascalCase), identical shapes are declared once, array elements are merged into one type with fields that are missing from some elements marked optional, mixed arrays become unions and null values become “| null”. Choose interface or type, readonly fields, export and the root name.
FAQ
For object shapes they are interchangeable in most code. Interfaces can be extended and merged; type aliases can also describe unions. The output is equivalent either way.
When an array contains several objects, a field that appears in only some of them gets a ?. Fields in a single object are always required.
No. Parsing and type generation run in your browser.
Related instruments