Generate a TypeScript interface from JSON
Automatically generate a TypeScript interface from a sample JSON.
How it works
Handy when you're consuming an API for which you have no schema or generated TypeScript client: paste a concrete sample of a JSON response, give the interface a name (for example User or ApiResponse), and get the corresponding TypeScript interface declarations immediately, including for nested objects (generated as named sub-interfaces) and arrays (typed as Type[]), without having to write them by hand.
How are arrays and `null` values typed?
null)[]. A field that is only ever null in your sample is typed as null: since no other value is available to guess the real type, it's recommended to widen this type manually (for example to string
Is the result guaranteed to be 100% correct?
No: this tool infers types from a single sample, so it doesn't replace a real schema (OpenAPI, JSON Schema) or server-side type generation. An optional field missing from your sample, or a numeric field that can sometimes be a string, won't be detected. Use the result as a starting point to refine, especially for an API whose response can vary.
Generation runs 100% locally in your browser via WebAssembly: your JSON, even from an internal or private API, never leaves your device.