Extract structured data as valid JSON
Pulls fields out of messy text into JSON that matches your schema exactly, with null for anything that is not there.
Extract data from the text below into JSON that matches this schema exactly:
```json
{{SCHEMA}}
```
Rules:
- Output only the JSON object. No explanation, no markdown fence.
- Use null when a field is not present. Never guess.
- Dates in ISO format (YYYY-MM-DD). Numbers without currency symbols or thousands separators.
- Keep text values exactly as written in the source, except trimming whitespace.
<text>
{{TEXT}}
</text>Example output
{ "company": "Northwind Ltd", "invoice_number": "INV-2041", "total": 1840.5, "due_date": "2026-12-01", "po_number": null }
How to use
Write SCHEMA as an example JSON object with the field names and types you want. In an API, use the provider’s structured output or tool-use feature with the same schema for guaranteed valid JSON, and validate the result in code either way.
Why it works
Clear rules for missing values and formats remove the guesswork that causes invalid or inconsistent JSON. In APIs you can go further by prefilling the reply with an opening brace or using a stop sequence, so the model only returns the object.