Free tools

JSON to TypeScript: types and Zod schema from any JSON

Paste JSON, like an API response, and get TypeScript types and a Zod schema you can drop into your project. It runs in your browser, so nothing is uploaded.

Write as

Your types show up here as soon as you paste JSON.

More free tools

How it works

  1. Paste your JSON on the left, for example an API response you copied from the browser’s Network tab. Or click Try an example.
  2. Pick a name for the main type and choose interface or type. If some items in a list are missing a field, that field is marked optional for you.
  3. Copy the TypeScript types, the Zod schema or the tidied JSON. Or copy the prompt and paste it into Claude Code, Cursor or Codex so your agent adds the types to your project.

Questions

Is my JSON sent anywhere?

No. The types are worked out in your browser. Your JSON never leaves your computer, so it’s safe to paste real API responses.

How does it know a field is optional?

When your JSON has a list of objects, it looks at every item. A field that’s missing from some items gets a ? (or .optional() in Zod). Tick Make every field optional if you want that for all fields.

Should I use interface or type?

Either works for API data. interface is the common choice for objects and gives slightly clearer error messages. Pick type if your project already uses it, so the code looks the same everywhere.

What is Zod and why would I want it?

TypeScript types only exist while you write code. Zod checks the data when your app actually runs, so if an API sends something unexpected you get a clear error instead of a blank screen. Run npm install zod, paste the schema, and call UserSchema.parse(data).

Why is a field typed as null or unknown[]?

The tool only knows what’s in your sample. If a field is always null, or a list is empty, it can’t tell what goes there. Paste a sample where that field has a real value, or change the type by hand.

It says my JSON has an error. What do I do?

The message gives the line and column and says what’s wrong in plain words, like a missing comma, an extra comma at the end of a list, or single quotes instead of double quotes. Fix that spot and the types appear right away.