JSON to TypeScript
Turn a JSON sample into TypeScript types or a Zod schema.
JSON
TypeScript
Output
What it does
The converter reads a JSON sample and writes the matching TypeScript interfaces, or a Zod schema with inferred types. Keys that are missing in some list items become optional.
How to use it
- 1Paste a JSON sample.
- 2Pick TypeScript or Zod and name the root type.
- 3Copy the result or download it as a .ts file.
Questions
Is my JSON sent anywhere?
No. The types are worked out on your device.
How does it handle lists?
It merges every item of a list into one type, and marks keys as optional when some items lack them.
Are the types exact?
They describe your sample. Check them against your real data before you rely on them.
AD320 × 100