JSON to TypeScript
Convert JSON into TypeScript interfaces instantly. Paste a JSON sample and get clean, nested type definitions. Runs entirely in your browser.
Runs in your browser — nothing uploaded
JSON
TypeScript
TypeScript interfaces appear here
Paste JSON above to generate TypeScript types instantly.
Turn a JSON sample into TypeScript interfaces in seconds. Paste an API response or config object and get clean, nested type definitions — objects become interfaces, arrays are typed by their contents, and inconsistent keys are marked optional. Great for typing third-party data fast.
Private by design — your data never leaves your device
How to use it
No account, no upload — it all happens on your device.
1
Paste a JSON sample, or click Load sample.
2
Optionally rename the root type.
3
Read the generated TypeScript interfaces on the right.
4
Click Copy to drop them into your project.
How JSON maps to TypeScript
The rules behind the generated types.
| JSON | TypeScript |
|---|---|
| "hello" | string |
| 42 | number |
| true | boolean |
| null | null |
| ["a", "b"] | string[] |
| { "id": 1 } | interface with an id: number field |
Getting the best results
- Use a representative sample. Include array items that cover every optional field so the merged interface marks them correctly.
- Name the root. Setting a meaningful root type name keeps the generated interfaces readable and importable.
- Review unions. A field typed as
string | numberusually means your sample is inconsistent — decide which type is correct before shipping.
Frequently asked
How are nested objects and arrays handled?
Each nested object becomes its own named interface, and arrays are typed by their elements. When an array holds objects with differing keys, the tool merges them into one interface and marks keys that aren't always present as optional.
What happens with mixed or null values?
Mixed types become a union, like string | number. A null value adds null to the type. Empty arrays become unknown[] since there's nothing to infer from.
Is my JSON sent anywhere?
No. The JSON is parsed and the types are generated entirely in your browser. Nothing you paste is uploaded or stored.