JSON to TypeScript Interface
Paste JSON and get clean TypeScript interfaces — with merged array shapes and optional-property detection.
This tool runs 100% in your browser. Your data is never uploaded, stored, or logged.
TypeScript interfaces
About this tool
Typing API responses by hand is slow and error-prone. This converter reads a JSON sample and generates TypeScript interfaces for the whole structure — nested objects become named interfaces, arrays of objects are merged into a single shape, and keys that are missing from some items can be marked optional.
The result is ready to paste into your codebase, with or without export keywords.
How to use it
- Paste a representative JSON response.
- Set the root interface name (default
Root). - Toggle optional detection, export and semicolons to match your style.
- Copy or download the generated
.tsfile.
Useful ways to apply it
- Typing REST API responses without writing interfaces by hand.
- Generating types from fixture files in tests.
- Onboarding a legacy untyped payload into a TypeScript project.
- Quickly checking what shape a third-party webhook actually has.
Frequently asked questions
How are arrays with mixed objects handled?
Object items are merged into one interface containing every key seen. With optional detection on, keys not present in every item get a ? marker.
What about null values?
A null value types as null. If you expect string | null, edit the generated property — a single sample cannot know all possible types.
Is my JSON uploaded anywhere?
No — generation happens entirely in your browser.
Privacy
This tool runs 100% in your browser. Your data is never uploaded, stored, or logged.