waynetools/json-schema-builder
Updated 2026-07-11 · Built by Wayne

JSON Schema Builder for OpenAI & Anthropic Function Calling

Build a JSON Schema by adding fields, types, required flags, enums and nested objects/arrays — or paste a sample JSON to auto-infer one. Validate an example against it live, then copy it ready for OpenAI structured outputs (strict mode) or Anthropic tool_use. Runs entirely in your browser; nothing is uploaded.

100% client-side Free No signup Infer from JSON OpenAI strict mode export Anthropic tool_use export

Build the schema


      

Validate example JSON

No validation run yet.

What is this tool

This is a visual JSON Schema builder and live validator built for developers wiring up LLM tool calling. Instead of hand-writing nested properties and required blocks, you add fields through a form — key, type, required, description, enum values, string format — with full support for nested objects and arrays of any depth. Paste a real example response and the tool infers the whole tree automatically, including integer-vs-number and common string formats like email, uuid, date-time, date and uri, so you start from something close to correct instead of a blank editor.

The output is draft 2020-12 JSON Schema with additionalProperties: false at every object level, which is what OpenAI structured outputs and most strict validators expect. Two one-click exports handle the two dialects that matter for LLM tools today: an OpenAI-ready function definition with the strict-mode nullable rewrite applied automatically, and an Anthropic-ready tool_use block with input_schema. A built-in validator checks any example JSON against your schema and reports every mismatch with its exact path, so you can catch a wrong type or a missing key before it reaches your model or your API.

How to use it

  1. Start from a sample (fastest): paste a real JSON response into the infer box and click Infer schema. Review the generated fields.
  2. Or start from scratch: click + Add field, name the key, pick a type (string, number, integer, boolean, object, array), and toggle required.
  3. Nest as needed: set a field's type to object to attach its own sub-fields, or array to define the item type — including an array of objects.
  4. Add constraints: for strings, pick a format (email, uuid, date-time, date, uri) or a set of enum values comma-separated.
  5. Validate: paste an example JSON into the validate box and click Validate — every type mismatch, missing required key, unknown key, bad enum value or bad format is reported with its path (e.g. $.user.tags[2]).
  6. Export: switch the output tab to OpenAI (strict) or Anthropic and click Copy output to paste straight into your tool definition.

Two worked examples

Example 1 — flat user object

Input sample:

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "Jane Cooper",
  "email": "jane@example.com",
  "age": 29,
  "is_active": true
}

Generated schema (excerpt):

{
  "type": "object",
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "name": { "type": "string" },
    "email": { "type": "string", "format": "email" },
    "age": { "type": "integer" },
    "is_active": { "type": "boolean" }
  },
  "required": ["id","name","email","age","is_active"],
  "additionalProperties": false
}

Example 2 — nested array of objects

Input sample:

{
  "order_id": "ORD-4471",
  "items": [
    { "sku": "AB12", "qty": 2, "price": 19.99 },
    { "sku": "CD98", "qty": 1, "price": 4.5 }
  ]
}

Generated schema (excerpt):

{
  "type": "object",
  "properties": {
    "order_id": { "type": "string" },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "sku": { "type": "string" },
          "qty": { "type": "integer" },
          "price": { "type": "number" }
        },
        "required": ["sku","qty","price"],
        "additionalProperties": false
      }
    }
  },
  "required": ["order_id","items"],
  "additionalProperties": false
}

Validating {"order_id":"ORD-4471","items":[{"sku":"AB12","qty":"2","price":19.99}]} against this schema reports exactly one error: $.items[0].qty: expected integer, got string ("2") — the kind of silent type bug that breaks a downstream integration.

Frequently asked questions

What is JSON Schema and why do LLM tools need it?

JSON Schema is a vocabulary for describing the shape of JSON data: which keys exist, their types, which are required, and constraints like enums or string formats. OpenAI structured outputs and function calling, Anthropic tool_use, and the Model Context Protocol all use JSON Schema to describe a tool's parameters so the model returns data your code can parse without guessing.

Does this tool upload my JSON anywhere?

No. Building, inferring and validating all run in plain JavaScript in your browser. There is no server call, no analytics on your input, and no network request after the page loads.

What is OpenAI strict mode and how does the export differ from the plain schema?

Strict mode requires every property to be listed in required and additionalProperties: false at every object level; fields that are logically optional are instead made nullable by adding "null" to their type array. The plain JSON Schema tab keeps optional fields out of required. The OpenAI tab applies the strict-mode rewrite automatically.

How is this different from Anthropic's tool input_schema?

Anthropic tool_use accepts a standard JSON Schema object under input_schema without OpenAI's nullable rewriting. The Anthropic tab wraps your schema as { name, description, input_schema }, ready to drop into the tools array of a Messages API call.

Can it infer a schema automatically from an example JSON response?

Yes. Paste a sample into the infer box and click Infer schema. It detects object vs array vs primitive, separates integers from floats, and detects email, uuid, date-time, date and http/https uri formats by pattern-matching the value. You can then edit the generated tree by hand before exporting.

Does it support nested objects and arrays of objects?

Yes, to any depth. An object field can contain its own list of fields, and an array field has an item type that can itself be an object with fields, or another array.

What does the live validator actually check?

Type correctness (including integer vs number), presence of every required key, unknown keys when additionalProperties is false, enum membership, and the four supported string formats — each failure reported with its exact JSON path.