← All tools
JSON to TypeScript
Paste JSON on the left to generate TypeScript interfaces or type aliases on the right. Infers optional fields from null values. Your data never leaves your browser.
Style:
Name:
JSON Input
TypeScript Output
JSON Input
TypeScript Output
How to use JSON to TypeScript
- 1
Paste sample JSON
Paste a representative JSON value on the left. The TypeScript inference appears on the right.
- 2
Pick interface or type
Toggle between interface and type alias. Choose readonly fields and inline-vs-named subtypes for nested objects.
- 3
Set the root name
Name the root type so it slots into your codebase without renaming.
- 4
Copy or download .ts
Copy the result to your editor or download a .ts file.
Frequently asked questions
- Does this tool upload my JSON?
- No. Every parse, transform, and download runs entirely in your browser using JavaScript and Web Workers. The file never leaves your device — there is no upload endpoint and no server-side processing.
- What if my sample JSON doesn't cover every case?
- Inference is structural — fields seen as null become optional, empty arrays become unknown[]. Provide a richer sample or hand-edit the output to tighten the types.
- Why are nested objects inlined rather than named?
- Inline is the default to keep small samples readable. Toggle named subtypes to extract every nested object into its own interface — useful for larger schemas.