json

FormatValidateConvert

JSON to Claude

JSON
Language
Structured output

Result· read-only

—Claude

The result appears here.

Generate

JSON to a Claude structured output schema.

Your document never leaves the browser.

A structured-output schema for Claude, from an example answer — in your browser.

Claude can be held to a JSON Schema, either as the shape of its answer or as the input of a strict tool. Paste an example of what you want back and this page writes a schema that fits Claude’s rules and says when it is near one of Claude’s limits.

24

optional properties at most in one request

16

properties that use anyOf or a list of types, at most

0

bytes leave your machine

Optional stays optional

Unlike OpenAI’s strict mode, Claude accepts a property that is not required. So gift-wrap, missing from one of the line items, is simply left out of required, and keeps its plain boolean type. note, which the sample shows as null once, is typed ["null", "string"] and stays required.

Every object is closed with additionalProperties: false, so Claude cannot add keys of its own, and the nested objects are defined once under $defs. For this sample the list under the schema is empty, because nothing had to change to fit.

1

The sample, an order with two line items, pasted as the source

{
  "order_id": 1042,
  "placed_at": "2026-09-25T10:15:00Z",
  "paid": true,
  "customer": { "name": "Ada Lovelace", "email": "ada@example.com" },
  "items": [
    { "sku": "PEN-01", "qty": 2, "price": 3.5, "note": null },
    { "sku": "INK-07", "qty": 1, "price": 12, "note": "Fragile", "gift-wrap": true }
  ]
}
2

The schema written for it

{
  "type": "object",
  "properties": {
    "order_id": {
      "type": "integer"
    },
    "placed_at": {
      "type": "string"
    },
    "paid": {
      "type": "boolean"
    },
    "customer": {
      "$ref": "#/$defs/Customer"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Item"
      }
    }
  },
  "required": [
    "order_id",
    "placed_at",
    "paid",
    "customer",
    "items"
  ],
  "additionalProperties": false,
  "$defs": {
    "Customer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "email"
      ],
      "additionalProperties": false
    },
    "Item": {
      "type": "object",
      "properties": {
        "sku": {
          "type": "string"
        },
        "qty": {
          "type": "integer"
        },
        "price": {
          "type": "number"
        },
        "note": {
          "type": [
            "null",
            "string"
          ]
        },
        "gift-wrap": {
          "type": "boolean"
        }
      },
      "required": [
        "sku",
        "qty",
        "price",
        "note"
      ],
      "additionalProperties": false
    }
  }
}

Options

1

An answer and a score

{ "answer": "yes", "score": 0.9 }
2

With Output Request fragment and Use Strict tool

{
  "tools": [
    {
      "name": "root",
      "strict": true,
      "input_schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          },
          "score": {
            "type": "number"
          }
        },
        "required": [
          "answer",
          "score"
        ],
        "additionalProperties": false
      }
    }
  ]
}

Option

Output

Output: Schema, the default, or Request fragment, the part of the Messages API request that carries it.

Option

Use

Use, shown for a fragment: JSON output, the default, which places the schema under output_config.format, or Strict tool, which writes a tools entry with strict set to true and the schema as its input_schema.

Option

Name

Name, shown for a strict tool: the tool’s name, defaulting to your root name in snake_case.

Option

Make all fields required

Make all fields required: off by default. Turn it on to require every property and allow null in place of a missing one, as OpenAI’s mode does.

Limits the page checks

Claude allows at most 24 optional properties in one request, and at most 16 properties that use anyOf or a list of types. It also rejects a schema whose shape refers back to itself. The page counts all three and warns under the schema, and for too many optional properties it suggests the Make all fields required switch.

A root that is a list rather than an object is wrapped as a required property named items. A value the inference could not type becomes a string, and the list under the schema names its path.

1

A list of records as the root

[
  { "id": 1 },
  { "id": 2 }
]
2

Wrapped as a required property named items

{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RootItem"
      }
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": false,
  "$defs": {
    "RootItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    }
  }
}
  • Claude wrapped the root at $ as the required items object.

Your sample stays here

Inference and code generation both run inside this browser tab. The sample is never uploaded, stored on a server or logged, because the page has no server to send it to, and once loaded it carries on working with the connection off.

Read next:

FAQ

Frequently asked questions

Didn’t find your answer?Write to us on the contact page →
Does this page send anything to Anthropic?

No. The schema is written in the browser, and you make the request yourself, from your own code with your own API key.

JSON output or a strict tool: which should I pick?

JSON output when the answer itself should be the JSON. A strict tool when Claude should decide to call it, or when you already route answers through tools.

Why did a warning about 24 optional properties appear?

Your sample has more than 24 keys that were missing somewhere. Turn on Make all fields required, or trim the sample to the fields you need.

Keyboard shortcuts

Send feedback

Questions, bug reports and feature requests are all welcome. A bug report is easiest to act on with the shape of the document that caused it — never send anything confidential.

Email us

Contact page, in a new tab, so this page stays as it is.

Settings

Indent

The result is written with it — YAML and XML at 2 spaces when it is Tab.

Code text size
14 px

Both panes.

Wrap long lines

Load from a URL

Your browser fetches it directly — the request goes to that site, never to us.