JSON Schema Generator (with AI Tool-Call Builder)

Generate JSON Schema, TypeScript types, Zod schemas, and Python TypedDicts from sample JSON. Build OpenAI, Anthropic, and Gemini tool-call schemas with a visual parameter editor. 100% in your browser.

Function metadata

Used as identifier and class name for code output, plus the wrapper for OpenAI / Anthropic / Gemini tool calls.

Sample JSON

Output

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "name": {
      "type": "string"
    },
    "age": {
      "type": "integer"
    },
    "signupAt": {
      "type": "string",
      "format": "date-time"
    },
    "avatarUrl": {
      "type": "string",
      "format": "uri"
    },
    "address": {
      "type": "object",
      "properties": {
        "line1": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "postcode": {
          "type": "string"
        },
        "country": {
          "type": "string"
        }
      },
      "required": [
        "line1",
        "city",
        "postcode",
        "country"
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "id",
    "email",
    "name",
    "age",
    "signupAt",
    "avatarUrl",
    "address",
    "tags"
  ]
}

JSON Schema Draft 2020-12 โ€” works with Ajv, OpenAI structured outputs, and most validators.

100% client-side ยท your JSON never leaves the device

About JSON Schema Generator (with AI Tool-Call Builder)

The JSON Schema Generator turns a sample JSON object into a JSON Schema (Draft 2020-12), and from there into TypeScript interfaces, Zod schemas, or Python TypedDicts in one click. It also includes a visual tool-call builder for AI agent development โ€” define your function name, description, and parameters, then export the schema in OpenAI, Anthropic, or Google Gemini's expected tool-call format. Type and format inference is automatic: ISO 8601 strings become date-time, email-shaped strings get the email format, UUIDs get the uuid format, integers and floats are correctly distinguished, and arrays of objects are merged across elements so heterogeneous data still produces a valid schema. Everything runs in your browser โ€” your JSON never leaves the device.

Why use a JSON Schema Generator (with AI Tool-Call Builder)?

AI agent development in 2026 is a JSON Schema-heavy world. Every tool call to OpenAI, Anthropic, or Google needs a schema; every structured-output API needs a schema; every API contract benefits from one. Writing them by hand is tedious and error-prone โ€” typos in `required`, missing `additionalProperties: false` for OpenAI strict mode, wrong wrapper format for the provider you're targeting. This tool eliminates that friction: paste a sample of the data you want the model to return (or build the parameters visually), pick a target format, copy. The TypeScript / Zod / Python output saves a second round-trip โ€” the same definition you give the model is the same definition your application code uses to validate the response.

Who is it for?

Built for AI engineers building agentic systems and RAG pipelines, full-stack developers wiring up OpenAI / Anthropic / Gemini tool calling, backend engineers writing API request/response schemas, TypeScript developers who want fast type generation from sample data, Python developers needing TypedDicts for typed API clients, and technical product managers prototyping AI features who need to specify tool-call schemas for engineers. Anyone who has ever spent twenty minutes hand-writing a JSON Schema and then finding a typo on line 47 is the target user.

How to use the tool

1

Choose a mode at the top: 'Generate from JSON' to infer a schema from a sample, or 'Tool-call builder' to define parameters visually one at a time

2

In Generate-from-JSON mode, paste any JSON document โ€” the schema, types, and tool-call wrappers update live as you type

3

In Tool-call-builder mode, set the function name and description, then add parameters with name, type, description, required flag, and optional enum values

4

Pick an output format from the tabs: JSON Schema, TypeScript interface, Zod schema, Python TypedDict, or wrap directly as an OpenAI / Anthropic / Gemini tool call

5

Toggle 'Strict mode' for OpenAI output โ€” adds the strict flag and additionalProperties: false to every object

6

Click any sample button (User profile, Get weather, Stripe response, etc.) to load a realistic example to start from

7

Copy the output with one click and paste straight into your code

Key Features

Schema inference from sample JSON

Paste any JSON, get a JSON Schema (Draft 2020-12). Type detection includes integers vs numbers, ISO 8601 date-times, emails, URLs, and UUIDs โ€” output as `format` hints. Heterogeneous arrays of objects are merged so the schema covers every observed shape.

Visual tool-call parameter builder

Add parameters one at a time with name, type, description, required flag, and optional enum constraints. The schema updates as you type โ€” no JSON wrangling required for AI tool definitions.

Six output formats from one source

JSON Schema, TypeScript interface, Zod schema, Python TypedDict, plus pre-wrapped OpenAI / Anthropic / Gemini tool-call objects. Same definition, every consumer.

OpenAI strict-mode aware

Toggle strict mode and the OpenAI output gets `strict: true` and recursive `additionalProperties: false` โ€” the form OpenAI requires for guaranteed-valid structured outputs.

Realistic samples included

Pre-loaded examples cover the common cases: a user profile (nested objects + arrays), a get-weather tool call, a Stripe-style API response, a function-calling parameter spec.

100% client-side

Schema inference, codegen, and tool-call wrapping all run in your browser. Your JSON and prompts never leave the device โ€” verifiable in DevTools (zero network requests).

Common Use Cases

Defining a tool for an OpenAI / Claude / Gemini agent

Scenario: You're building an agent that calls a `create_calendar_event` function and need a tool-call schema for OpenAI's `tools` parameter or Anthropic's `tools` array.

โœ“ Switch to Tool-call builder, type the function name and description, add `title`, `start`, `end`, `attendees` parameters, copy the OpenAI-formatted output. Paste straight into your agent definition. Switch the format toggle to Anthropic or Gemini for the same schema in those providers' shapes.

Generating TypeScript types from an API response

Scenario: You're integrating a third-party API, you've got one example response, and you need TypeScript types to use it safely.

โœ“ Paste the response JSON, switch to the TypeScript tab, copy. The output is an `interface` with proper optional vs required fields, nested objects inlined, arrays typed.

Adding Zod validation to an API client

Scenario: Your TypeScript API client uses Zod for runtime validation, and you need a Zod schema that mirrors the API response shape.

โœ“ Same input as the TypeScript flow, switch to the Zod tab. Output uses `z.string().email()`, `z.string().uuid()`, `z.string().datetime()` automatically when those formats are detected. `optional()` is added for non-required fields.

Prototyping structured-output schemas

Scenario: You want the model to return a specific shape โ€” say, a list of extracted entities with categories and confidence scores โ€” and need a schema for OpenAI's response_format JSON Schema mode.

โœ“ Sketch one example by hand, paste it, toggle strict mode, copy as OpenAI tool-call format. The strict-mode flags and additionalProperties: false are added automatically.

Cross-team API contract specification

Scenario: Frontend and backend teams need an agreed-on API shape; you have a sample response from the backend's prototype.

โœ“ Generate the JSON Schema as the canonical contract, generate TypeScript for the frontend team, generate Python TypedDicts for the backend team's typed client. One source, three consumers.

JSON
Schema Draft 2020-12 spec-compliant output, OpenAI strict-mode aware, format hints (date-time / email / uri / uuid) auto-detected.
100%
client-side โ€” your JSON never leaves your device. No upload, no API call, no analytics on input content.
Static
site โ€” no backend dependency.

Frequently Asked Questions

Which JSON Schema draft does this generate?

Draft 2020-12 by default โ€” the version OpenAI, Anthropic, and Google all currently expect for tool calling and structured outputs. The output is also valid for Draft 2019-09 and Draft 7 since the constructs used (type, properties, required, items, enum, format) are stable across drafts.

Why are integers and numbers distinguished?

JSON itself has only one numeric type, but JSON Schema separates `integer` and `number`. Most validators (Ajv, the model providers' validators) treat them strictly. We infer `integer` when every observed value is a whole number with no decimal point, otherwise `number`. This matters because `42.0` parsed in some languages becomes `42` and would then fail an `integer` schema check.

What does 'OpenAI strict mode' actually do?

OpenAI's structured output and strict tool calling guarantee the model's response will exactly match your schema โ€” no extra fields, no missing required fields. To enable that, the schema must declare `strict: true` and have `additionalProperties: false` recursively on every object. Toggling strict mode in the tool sets both for you. Anthropic and Gemini have their own strictness models โ€” strict mode only modifies the OpenAI output.

Why is `description` so important on every property?

For tool calling, the model uses the property descriptions to decide *what value to pass*. A parameter named `id` with no description forces the model to guess; a property documented as 'The user's UUID, e.g. f47ac10b-58cc-4372-a567-0e02b2c3d479' gets the right value far more often. The Tool-call builder mode requires descriptions because of this โ€” they're the most important part of a tool schema after the names.

Can the inferred schema be wrong?

It's only as good as the sample. If your sample only contains one variant of a polymorphic field, the schema will look like that variant is the only one allowed. For production schemas, paste 3-5 representative samples wrapped in an array โ€” the merger then computes a union of all observed shapes.

How are arrays of mixed objects handled?

When an array contains objects with different keys, the merger combines all observed properties and marks fields as required only if they appear in every observed item. This produces a permissive but correct schema. If you want stricter behavior โ€” distinct subtypes via `oneOf` โ€” you can edit the output by hand; auto-generation of `oneOf` is on the roadmap.

Does this tool send my JSON anywhere?

No. Schema inference, type generation, and the tool-call wrapping all run in your browser with pure JavaScript. Verifiable in your DevTools network tab โ€” using the tool produces zero outbound requests with your JSON.

Why generate four different output formats from one input?

Because in real AI projects you need all four. The JSON Schema goes to the model provider; the TypeScript interface goes to the frontend that displays the response; the Zod schema goes to the API layer that validates the response at runtime; the Python TypedDict goes to the backend agent that calls the model. Generating once and exporting four is dramatically faster than writing each by hand and keeping them in sync.

Technical Specifications

Supported Formats

  • โœ“Inference from JSON: object, array, string, number, integer, boolean, null
  • โœ“Format detection: date, date-time, email, uri, uuid
  • โœ“Output: JSON Schema (Draft 2020-12), TypeScript interface, Zod schema, Python TypedDict
  • โœ“Tool-call wrappers: OpenAI (function calling + strict mode), Anthropic (input_schema), Google Gemini (parameters)
  • โœ“Visual builder: name, type, description, required, enum constraints per parameter
  • โœ“Heterogeneous-array merging: properties present in all items become required, others optional

Limits & Performance

  • โ€ขFile Size: Practical limit ~10 MB sample JSON; tokenization and inference are linear
  • โ€ขValidations: Live JSON parsing with inline errors; samples up to a few hundred KB process in <100ms
  • โ€ขResponse Time: Synchronous, in-browser
  • โ€ขBrowsers: All modern browsers (Chrome, Firefox, Safari, Edge); works offline once loaded

Pro Tips

  • For tool-calling schemas, descriptions on every parameter matter more than the type โ€” the model uses descriptions to decide what to send. 'User's email' is fine; '' is a guess.
  • Use OpenAI strict mode whenever you can. Costs you nothing at runtime, makes the model's structured output reliable.
  • If your sample JSON has nullable fields, include them with `null` values โ€” the inferrer detects this and emits `"type": ["null", "string"]` (or the equivalent).
  • For polymorphic fields (e.g. an event that's either type=login or type=logout), feed in 3-5 representative samples in an array โ€” the merger handles the union correctly.
  • When generating Zod for a chat / agent response, validate the output before parsing it as your domain object. The two-step (Zod parse โ†’ domain object) is faster to debug than a try/catch around your business logic.
  • Property names with hyphens or spaces (`first-name`, `Date Created`) get quoted automatically in the TypeScript output. Renaming them to snake_case or camelCase first usually produces cleaner downstream code.
  • For Python: `NotRequired[T]` is from Python 3.11+. On older Python you can use `Optional[T]` and live with the slight semantic difference, or stick with the runtime check.

Share This Tool

Found this tool helpful? Share it with others who might benefit from it!

๐Ÿ’ก Help others discover useful tools! Sharing helps us keep these tools free and accessible to everyone.

Support This Project

Buy Me a Coffee