Template · Schema
Structured JSON output prompt
How to get reliable JSON out of an LLM without parsing pain. Use sparingly — Claude and GPT both support structured-output APIs natively.
When to use
When you need a downstream system to consume the model's output. Pair with the structured-output API of your model where available.
The template
Replace placeholders in <ANGLE_BRACKETS> with your own values before deploying.
# Structured JSON output prompt
You are generating a JSON object for downstream consumption. Follow these rules without exception:
1. Output ONLY a valid JSON object. No prose, no markdown, no code fences.
2. Match this exact schema:
```
{
"field_a": string, // <description>
"field_b": number, // <description, units>
"field_c": "option1" | "option2" | "option3",
"field_d": string[], // <description>
"confidence": number // 0-1
}
```
3. If you can't fill a field confidently, omit it rather than guessing.
4. Strings should be plain text, no markdown.
5. Numbers should not include units in the value (units belong in the field name).
# Validation
After generating, verify:
- All fields parse as the declared type
- "option" fields are one of the enumerated values
- confidence reflects your actual certainty, not a default of 1.0
# Input
{{input_text}}
# Output (JSON only)
Want help adapting this?
Templates get you started. We tune them, eval them, and ship them into production for clients in 4–8 weeks.