Types from real data, not guesses
Hand-writing types for a 40-field API response is tedious and error-prone. Paste the response and get accurate, merged types — including the optional fields you would have missed — ready to drop into your codebase.
How to use JSON to TypeScript
- Paste a JSON sample — a real API response gives the best types.
- Pick the output: interfaces, types, JSON Schema or Zod, and set the root name.
- Copy the result into your project or download it as a
.ts/.jsonfile.
Private by design
JSON to TypeScript runs entirely in your browser. Your data is parsed and converted on your device with JavaScript — it is never sent to a server, logged or used for analytics. Recent inputs are kept in your browser’s own storage so you can come back to them, and they disappear when you clear cookies and site data (or press Clear history). You can verify this in your browser’s network tab.
Frequently asked questions
How does it know which fields are optional?
When your JSON has an array of objects, all items are merged. A field missing from some items becomes optional (?), and a field that is sometimes null becomes T | null. Fields with different types across items become a union.
Can I get a JSON Schema or Zod schema instead?
Yes. Switch the output between TypeScript interfaces, type aliases, JSON Schema (draft-07) and a Zod schema with inferred type.
How are nested objects named?
Each nested object becomes its own named type from its property name — customer becomes Customer, and items[] becomes Item. Name clashes get a numeric suffix.
Is my JSON sent anywhere?
No. Types are generated entirely in your browser.