📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Prompt Engineering Output Format Control

Output Format Control

5 min read Quiz at the end
Specify JSON, markdown, tables, or custom formats to get consistent, machine-readable LLM outputs.

Controlling Output Format

Specify exactly how you want output structured to make parsing and downstream use reliable.

# JSON output
Extract the following from the invoice and return as valid JSON only.
No markdown, no explanation, just raw JSON.
{
  "invoice_number": string,
  "date": "YYYY-MM-DD",
  "vendor": string,
  "total": number,
  "line_items": [{"description": string, "amount": number}]
}

Invoice: [text]

# Custom structure
Answer in this exact format:
SUMMARY: [one sentence]
PROS: [bullet list, max 3 items]
CONS: [bullet list, max 3 items]
VERDICT: [one word: Recommended / Avoid / Neutral]

# Length control
Respond in exactly 3 sentences.
Use fewer than 100 words.
Answer Yes or No, then one sentence explanation.
Topic Quiz · 1 questions

Test your understanding before moving on

1. Which output format is best for machine processing?
💡 JSON is structured, parseable, and easy to process programmatically in any language.