Answer: Define a JSON Schema describing the shape of data you want, then pass it to query() via the outputFormat option (TypeScript) or output_format option (Python); when the agent finishes, the result message includes a structured_output field with validated data matching your schema. Status: Confirmed Entry: tool/claude-code/agents-and-automation/structured-output-quick-start Revision: 1 Digest: sha256:ec9d8dc205c1c22e (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:01Z Last changed: 2026-11-13T03:03:01Z Last verified: 2026-11-20T12:17:26Z Next check: 2026-11-21T12:17:26Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of TypeScript option | outputFormat | [1] | 2026-11-20 Python option | output_format | [1] | 2026-11-20 Result field | structured_output | [1] | 2026-11-20 Format type | json_schema | [1] | 2026-11-20 Sources: [1] Anthropic. "Get structured output from agents". https://code.claude.com/docs/en/agent-sdk/structured-outputs.md Role: primary. Accessed: 2026-11-20T12:17:26Z Quote: "pass it to `query()` via the `outputFormat` option (TypeScript) or `output_format` option (Python)" (Supports: TypeScript option, Python option) Quote: "the result message includes a `structured_output` field with validated data matching your schema" (Supports: Result field) Quote: "type: "json_schema"," (Supports: Format type) Published: 2026-11-20T02:57:54Z Snapshot SHA-256: e9e1254217642a03b1b5dc046b43102443b7c7cfcfc3c0590efb9468f8b5ae75 (captured 2026-11-13T03:03:01Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:03:01Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:17:26Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:17:26Z Last attempt: 2026-11-20T12:17:26Z Notes and limitations: Extracted automatically from a single official source (section "Quick start"). Related: https://latestn.com/tool/claude-code/agents-and-automation/stub-claude-answers-in-test How do I stub what Claude Code would answer in a Claude Code mod test? https://latestn.com/tool/claude-code/agents-and-automation/test-timer-drawing How do I test a timer or a drawing in a Claude Code mod? https://latestn.com/tool/claude-code/agents-and-automation/tool-return-images-structured-data How do I return images or structured data from a Claude Code custom tool? https://latestn.com/tool/claude-code/agents-and-automation/streamevent-reference What StreamEvent types does the Claude Code Agent SDK emit when streaming? https://latestn.com/tool/claude-code/agents-and-automation/streaming-limitations What are the known limitations of streaming output in the Claude Code Agent SDK? https://latestn.com/tool/claude-code/agents-and-automation/structured-output How do I get structured output from Claude Code programmatically? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:03:01Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/agents-and-automation/structured-output-quick-start/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/agents-and-automation/structured-output-quick-start POST: https://latestn.com/dispute/tool/claude-code/agents-and-automation/structured-output-quick-start with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/agents-and-automation/structured-output-quick-start?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I get validated JSON structured output from a Claude Code agent? Revision 1, last verified 2026-11-20T12:17:26Z. https://latestn.com/tool/claude-code/agents-and-automation/structured-output-quick-start (accessed 2026-11-21T09:58:04Z). @misc{LatestN_tool_claude_code_agents_and_automation_structured_output_quick_start_r1, title = {How do I get validated JSON structured output from a Claude Code agent?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/agents-and-automation/structured-output-quick-start}}, note = {Revision 1; digest sha256:ec9d8dc205c1c22e; last verified 2026-11-20T12:17:26Z; accessed 2026-11-21T09:58:04Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/agents-and-automation/structured-output-quick-start