Claude Structured Output JSON Schema: Complete Guide
What You’ll Learn
- How Claude structured output with JSON Schema works
- The current
output_config.formatrequest shape - How to design practical schemas for production workflows
- When to use JSON outputs versus strict tool use
- Common mistakes that make structured generation less useful
If you want a complete guide to Claude structured output with JSON Schema, the most important thing to understand is this: structured output is not just “Claude returning JSON.” It is a response-format contract enforced through the API.
That changes the engineering story significantly.
Instead of asking Claude nicely to produce valid JSON, you provide a JSON Schema through output_config.format and get a response that is intended to match that schema for downstream processing.
For production AI systems, that is a big deal.
What Claude Structured Output Solves
Without a schema, a typical pipeline has several weak points:
- invalid JSON
- missing fields
- extra fields you did not expect
- output phrased for humans instead of systems
- retry logic added just to repair format problems
Structured output reduces that category of failure by moving the format constraint into the request contract.
The Current Request Shape
Anthropic’s docs now use output_config.format for JSON outputs.
The basic shape looks like this:
{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Extract the company, contact email, and priority from this support request."
}
],
"output_config": {
"format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"company": { "type": "string" },
"email": { "type": "string" },
"priority": {
"type": "string",
"enum": ["low", "medium", "high"]
}
},
"required": ["company", "email", "priority"],
"additionalProperties": false
}
}
}
}
The point is not just to get JSON syntax. The point is to get a known shape your application can rely on.
A Good Schema Is Small and Intentional
One of the easiest mistakes is overdesigning the schema too early.
I prefer schemas that are:
- small
- explicit
- hard to misread
- close to the actual product need
For example, if a field can only be one of three states, use an enum. If extra keys would create confusion, disable them. If a field should always exist, require it.
That discipline matters just as much as the API feature itself.
Practical Example: Ticket Classification
This is a great fit for structured output.
{
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": ["billing", "bug", "feature"]
},
"priority": {
"type": "string",
"enum": ["low", "medium", "high"]
},
"summary": {
"type": "string"
}
},
"required": ["category", "priority", "summary"],
"additionalProperties": false
}
This works well because the output is not the final user experience. It is a structured step in a workflow.
JSON Outputs vs Strict Tool Use
Anthropic’s docs frame this as two complementary features:
- JSON outputs: control what Claude returns
- strict tool use: control how Claude calls tools
That distinction is important.
Use JSON outputs when you need structured response data. Use strict tool use when you need validated tool names and tool parameters.
If you are building an agent or workflow, you may end up using both.
When Claude Structured Output Is Worth It
I would strongly consider it for:
- extraction pipelines
- classification tasks
- report generation
- dynamic UI payloads
- AI steps that feed automation
I would care less about it for:
- longform writing
- brainstorming
- general chat responses for humans
The rule is simple: if code depends on the shape, use structure.
Common Mistakes
Prompting for JSON instead of using structured output
That is still suggestion, not a proper response contract.
Making the schema too big too early
Large schemas often reflect unclear product boundaries.
Forgetting that structured output is for systems, not style
The goal is reliability, not more literary responses.
Using JSON outputs where tool use is the real need
If the system needs Claude to call functions, strict tool use may be the better primary pattern.
Final Thought
Claude structured output with JSON Schema is one of the most practical features you can use when AI is part of an actual system instead of just a chat box.
Once your application depends on the response shape, output_config.format becomes much more valuable than “please return valid JSON” prompting. It gives the workflow a real contract, and that makes everything downstream simpler.
If you need help building Claude-powered pipelines, structured extraction workflows, or production AI tools with reliable contracts, take a look at my portfolio: voidcraft-site.vercel.app.