Back to MD Exchange
    Prompts & Templatesstructured-outputjsonpromptsvalidation

    Structured Output Prompt Patterns

    Prompt Claude for JSON, YAML, and markdown tables, then validate the output. Validation and recovery strategies.

    Y
    yukitanaka|March 16, 2026|Updated Oct 8
    118 downloads25 stars

    Uploaded markdown content, not a verification of tool compatibility or results. Review the raw text, commands, and permissions before using it. Stars require an account.


    name: structured-output


    Structured Output Patterns

    JSON with Schema

    Provide exact schema, say 'Output only valid JSON, no fences.'

    Markdown Table

    Specify columns explicitly.

    Numbered Steps

    Say 'List exactly N steps, one sentence each.'

    Validation

    1. JSON.parse()
    2. Zod schema validation
    3. If invalid, retry with error message
    4. Max 2 retries