Skip to content

Free developer tool · runs in your browser

JSON to TypeScript interfaces and Zod schemas.

Paste a real response and get the types for it: TypeScript interfaces for your editor, and a Zod schema that checks the same shape at runtime, for API responses and for the structured output of an LLM. Nothing is uploaded.

Output
Declare as
1,451 chars
TypeScriptTypeScript
Types
7
Optional keys
1
Union fields
1
Lines
46

Privacy: this tool runs in your browser. Your JSON is not uploaded or logged. A shared link keeps the input after the #, which browsers never send to a server.

Follows: Zod (checked 2026-10-18) · OpenAI (checked 2026-10-18) · RFC 8259 (checked 2026-10-18)

What this tool does


Types from the data you actually receive.

  • 01

    Array items merged into one type

    Every element of an array is read, not just the first, and merged into one type. A key present in some items and not others becomes optional; a field that is an object in one item and null in another becomes a union.

  • 02

    Nested types, named for you

    Each nested object becomes its own named type: orders gives Order, customer gives Customer. Identical shapes share one type, and a clashing name takes its parent’s as a prefix. Choose interface or type, and the root name.

  • 03

    Zod for runtime checks and LLM output

    TypeScript types vanish at runtime; a Zod schema does not. Use it to validate an API response before you trust it, or to define the structured output you ask a model for: the OpenAI SDK accepts a Zod schema for exactly that.

FAQs · JSON to TypeScript


JSON to TypeScript and Zod · frequently asked questions

Optional keys, unions, Zod versions and LLM output.

Every element of every array is read and merged. A key that appears in some objects at a place and not in others is marked optional (key?: type in TypeScript, .optional() in Zod). With a single object there is nothing to compare, so paste several records for the best result.
For object shapes like these, either works. Interfaces can be extended and merged; type aliases can express unions directly. Pick whichever your codebase already uses; the tool writes both.
Zod 4 by default, where integers are z.int(). Choose Zod 3 to get z.number().int() instead; the rest of the generated code is the same in both versions.
A model asked for JSON can still return a missing field or a wrong type. A Zod schema both describes the shape you want and checks the reply at runtime, and the OpenAI JavaScript SDK accepts a Zod schema directly for structured outputs. Generate it from an example of the output you expect.
No. It runs entirely in your browser: nothing you paste is sent to QalbIT, logged or stored. A shared link keeps your input after the # in the address, and browsers never send that part to a server.
Yes, from the same kind of sample, in the JSON Schema validator and generator. It uses the same rules for required keys and merged arrays, so the schema and these types agree.

Next step


Typing an API end to end?

QalbIT builds TypeScript backends and front ends that share one set of types, from the database to the screen, so a renamed field is a compile error rather than a bug report.

More free tools


More free tools

Each one opens on a worked example and shows its answer without a signup.

All free tools