JSON → TypeScript / Zod / Schema

    JSON → TypeScript / Zod / Schema

    Paste JSON, get TypeScript interfaces, Zod schemas, or JSON Schema for LLM function-calling

    export type User = {
      id: string;
      email: string;
      age: number;
      active: boolean;
      roles: string[];
      profile: {
        name: string;
        avatar_url: string;
      };
      last_login: null;
    };

    About the JSON → TypeScript / Zod / Schema

    Modern LLM tool-use (function calling) requires you to describe your tool inputs as JSON Schema. Writing that by hand for every endpoint is tedious. This converter lets you paste a representative JSON example and get JSON Schema, TypeScript interfaces, or Zod schemas instantly — skip the boilerplate and ship faster.

    Features

    How it works

    1. Paste a JSON example of the data shape you want to describe.
    2. Pick target: TypeScript, Zod, or JSON Schema.
    3. Copy the output into your function-calling tool definition or type declaration file.

    Use cases

    Frequently asked questions

    Why Zod specifically?

    +

    Zod is the dominant TypeScript runtime validation library and integrates seamlessly with function-calling / tool-use flows. Vercel AI SDK, OpenAI Node SDK, and Anthropic SDK all accept Zod schemas directly.

    Can I get types that match a JSON Schema (the reverse direction)?

    +

    Yes — our emitter takes a schema node; JSON Schema you paste gets rendered directly. Full round-trip support.

    What about enums?

    +

    If your example contains several variations of the same field, we infer string literals. For manual enum extraction, paste an array of sample values as the root.

    Does it handle unions?

    +

    Nullable fields (null | number) yes; arbitrary unions require multiple samples merged automatically.

    Is this safe for function-calling tool definitions?

    +

    Yes. OpenAI's tools API and Anthropic's tool_use accept JSON Schema directly — copy the JSON Schema output straight into your tool manifest.