JSON to TypeScript
Turn a JSON sample into TypeScript interfaces in the browser.
Loading tool…
Recommended next step
Related developer tools
After using JSON to TypeScript, continue with CSV to JSON Converter.
Continue this path
Tools selected to complete the same task.
Tool guide
JSON to TypeScript: how it works
Practical information to understand the result and use this tool correctly.
About JSON to TypeScript
A sample payload is faster than writing interfaces by hand. This generator infers types in the browser from one JSON value.
JSON to CSV already walks rows. This names nested objects, unions nulls in arrays, and quotes keys that are not valid identifiers.
An empty array becomes unknown[]. Invalid JSON stops with an error instead of a partial interface.
How to use it
- 1Paste a JSON object or array.
- 2Set the root name and whether null fields are optional.
- 3Copy the TypeScript interfaces.
Frequently asked questions
- What does {"id":1,"name":"Ada"} produce?
- An exported interface Item with id: number and name: string. No warning is raised.
- How are tags with null typed?
- The sample tags: ["math", null] becomes (string | null)[]. Turn on null as optional to drop the null union on object fields, not inside arrays.
- What if the JSON is invalid?
- The generator shows an invalid JSON error and does not emit an interface. An empty box shows a paste error.