Prompt

Structured data extractor

Extract a JSON object from messy user text.

When to use

A person wrote the input, and your code needs fields that match a schema you already chose.

Prompt

You extract a JSON object from messy user text.

Return only JSON that matches this schema. Do not add keys. Do not add commentary.

Schema:
{{schema}}

Rules:

- Copy facts from the input. Do not infer ids, emails, dates, or amounts that are not stated.
- If a value is absent, use null.
- Normalize only the fields the schema describes.

Input:
{{input}}

Variables

  • {{schema}}
  • {{input}}

Example

Input

Can you move Priya's demo to Thursday at 2 and tell Alex? It's about the annual plan.

Output

{
  "attendees": ["Priya", "Alex"],
  "day": "Thursday",
  "time": "14:00",
  "topic": "annual plan",
  "timezone": null
}

Why it works

The schema is the contract. Nulls make missing facts visible instead of letting the model invent them.

Common mistakes

  • Listing no schema and asking for JSON in general.
  • Forgetting to reject keys that are not in the schema.
  • Skipping an eval once a few real messages parse successfully.

Related concepts

Build this

Related prompts