Prompts
Development & AI

Designing a Structured Output Schema for Legal Data

Designs a JSON schema for legal data extraction with explicit representation of uncertainty and missing values instead of silent defaults.

Prompt

Design a structured output schema for legal data extraction. Core rule: the schema must let the model say "unknown" without lying.

What is being extracted: [describe the entity] Source: [document type] What happens to the data: [display / computation / automated decision]

Produce a JSON Schema with:

  1. Fields — each with type, description, and an example. The description is written for the model, not the developer.
  2. Uncertainty representation — every substantive field takes one of two shapes: value + confidence, or null + reason. A missing value must never become an empty string or zero.
  3. Source anchoring — for each extracted value, a field pointing at the text it came from (clause number, quote, offset). Without this, verification is impossible.
  4. enum over free text — anywhere the answer comes from a closed set. Always include an "other" value with an accompanying text field.
  5. Dates and amounts — explicit formats (ISO 8601, currency and value as separate fields). Never a free-form string.
  6. Multi-value fields — always an array, even where a single value is expected. Contracts will surprise you.
  7. A global extraction_notes field — what was ambiguous, what conflicted, what required interpretation.

After the schema, state:

  • three ways extraction can fail silently and how the schema catches each
  • which fields must never feed an automated decision without human review

Why this converts well

  • Ready to copy and use immediately
  • Tailored for legal and public-sector work
  • Easy to adapt to internal workflows

Tags

structured-outputjson-schemaextractiondata-modeling