press ⌘K to switch tools
FORMAT & CONVERT
JSON to TypeScript Interface Generator
Generate TypeScript interface definitions from JSON.
json-code
§01 ABOUT THIS TOOL
Overview
Paste a JSON payload and get matching TypeScript interface declarations —
handy when wrapping an undocumented API, typing a config file, or bootstrapping
DTOs from a sample response. Primitives map to string, number, and
boolean; nested objects are extracted into separate interfaces; property
names that are not valid identifiers are quoted automatically.
How to use
- Set the name of the top-level interface in Root type name (defaults to
Root). - Paste your sample into the JSON area.
- Copy the generated declarations from the TypeScript output, which updates as you type.
Examples
-
{"id":1,"name":"Alice","meta":{"active":true}}→interface Root { id: number; name: string; meta: Meta; }plus a separate
interface Meta { active: boolean; }.
Notes
Types are inferred from a single sample: null values are typed as null,
optional fields cannot be detected, and unions never appear. Treat the output
as a starting point and adjust nullability and optionality against the real API
contract.
FAQ
Is my JSON sent to a server?
No. Parsing and type generation run entirely in your browser. Nothing is uploaded, so pasting API responses that contain real data is safe.
How are nested objects handled?
Each nested object becomes its own named interface, derived from the property key (e.g. a "meta" property produces a Meta interface), and the parent references it by name.
How are arrays typed?
The element type is inferred from the first item of the array. An empty array is typed as unknown[], so refine those by hand if you know the real element type.