Back to Prompt Library

Structured Output

A structured extraction prompt for clean JSON output from unstructured text, notes, or documents.

Reviewed: 2026-03-18

Use this when you need reliable machine-readable output from free-form text and you want the model to stay inside a strict schema.

Prompt Template

Extract the information below and return valid JSON only.

Schema:
{schema}

Rules:
- If a field is missing, use null.
- Keep original wording where possible.
- Do not invent facts.
- Return one JSON object and nothing else.

Input:
{text}

Customize the variables before using the template in production workflows.

Best for

  • Extracting entities from articles or notes
  • Turning meeting notes into action items
  • Normalizing messy text before downstream automation

Expected output

  • Valid JSON only
  • Null for missing fields
  • No hallucinated facts
  • Stable schema matching

Variables to customize

schema

Target JSON schema or shape

Example: { customer, issue_type, due_date, action_items[] }

text

Source content to parse

Example: Meeting notes, email thread, article

Optimization tips

  • Put the schema directly in the prompt, not just in your head.
  • Tell the model how to handle missing values.
  • If output validity matters, validate it after generation and retry with the error message.

Example use case

Extract customer name, blocker, owner, due date, and actions from a long support escalation email.

Expected result

The model returns a clean JSON object that can be stored or processed by code without manual cleanup.

References