Back to guide/General Productivity

Structured JSON Output

GPT-4o is highly reliable at structured JSON output when given an exact schema. Adding confidence scores and source text spans makes the extraction auditable. The 'never fabricate' rule with null fallback prevents hallucinated data in extraction tasks.

gpt-4o-promptsinputTypeinputContentjsonSchema
Edit View
Prompt
Extract structured data from the following {{inputType}}:

<input>
{{inputContent}}
</input>

**Output as JSON matching this exact schema:**
\`\`\`json
{{jsonSchema}}
\`\`\`

**Extraction rules:**
- If a field is not found in the input, use null (never fabricate data)
- For {{ambiguousField}}: {{disambiguationRule}}
- Normalize {{fieldsToNormalize}} to {{normalizationFormat}}
- If multiple values exist for a single field, return as array

**Validation:**
- {{validationRules}}
- Include a "_confidence" field (0.0-1.0) for each extracted value
- Include a "_source" field with the exact text span used for extraction

Return ONLY the JSON object. No markdown, no explanation.

Variables to customize

{{inputType}}{{inputContent}}{{jsonSchema}}{{ambiguousField}}{{disambiguationRule}}{{fieldsToNormalize}}{{normalizationFormat}}{{validationRules}}

Why this prompt works

GPT-4o is highly reliable at structured JSON output when given an exact schema. Adding confidence scores and source text spans makes the extraction auditable. The 'never fabricate' rule with null fallback prevents hallucinated data in extraction tasks.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.