Data Processed in your browser Free New

JSON to TypeScript Interface Generator

Paste an API response and get clean TypeScript interfaces. Fields missing from some array items become optional, mixed values become unions, and nested objects get their own named interfaces.

Try it now

Example

[{"id":1,"name":"Ada"},{"id":2,"age":30}] becomes an interface with id: number, name?: string and age?: number.

Quick answers

Can I get a Zod schema instead?

Yes — switch the mode to JSON → Zod schema.

How to use JSON Converter

  1. Choose what to convert to: TypeScript, Zod, CSV — or CSV to JSON.
  2. Paste your JSON (or CSV). The output updates as you type.
  3. Copy it or download it as a file.

What makes the types accurate

CSV details

Frequently asked questions

Is my JSON sent to a server?

No. Conversion happens in your browser; nothing you paste is uploaded or stored.

Which Zod version is the output for?

It uses the core API (z.object, z.array, z.union, .optional(), .nullable()) that works in Zod 3 and Zod 4.

My JSON has an error — what now?

Open it in the JSON Formatter, which explains the error and can repair common problems like trailing commas or single quotes.

What does an empty array become?

unknown[] in TypeScript and z.array(z.unknown()) in Zod, because there's nothing to infer from. Paste a sample with at least one item for a precise type.