CClaude Cert Prep
P2Claude Models, Prompting & Context EngineeringConcept

Structured output

Also: JSON output · schema-constrained output · tool-based JSON

Getting the model to return machine-parseable data (usually JSON) that conforms to a schema you define.

View .md

Why CCAR-P tests this

The exam checks you know schema-valid JSON is not the same as semantically correct data — validation catches shape, not truth.

Structured output means having Claude return data in a predictable, parseable shape — commonly JSON — so downstream code can consume it reliably. You get this by specifying the schema clearly, giving an example, and often by using tool/function definitions whose input schema constrains the fields and types.

The critical distinction: schema-valid does not mean semantically correct. The model can emit perfectly-formed JSON that parses cleanly yet contains a wrong value, a hallucinated field entry, or a mislabeled category. Schema validation guarantees shape, not truth. So you still validate the content — ranges, enums, referential checks, business rules — beyond just "did it parse."

Practical tips: define required fields and types explicitly, prefer enums for categorical fields, keep the schema as tight as the task allows, and handle the case where output must be repaired or re-requested. Structured output pairs well with tools, where the model's arguments are naturally schema-bound.

Exam trap

"The JSON validated, so the answer is correct" is wrong — valid structure says nothing about whether the values are accurate; verify semantics separately.

All CCAR-P concepts

Independent, unofficial study material from Claude Cert Prep. Not affiliated with Anthropic.