Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Build a Four-Field Structured Summary Response with JSON Schema

Define the four keys your application needs, describe them in JSON Schema, and use schema-based Structured Outputs when supported—not merely JSON mode when shape matters.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To make an API return a summary in a fixed four-field object, define those four keys and their value types in a JSON Schema, then use the endpoint’s json_schema response format where supported. This is different from JSON mode: the API reference describes json_schema as enabling Structured Outputs intended to match the supplied schema, while json_object ensures valid JSON without the same schema-conformance guarantee. The title does not determine what the four fields should be; choose them to match the object your application actually needs.

Decide the four-field contract before writing the schema

Start with the consumer of the response: name each key exactly, choose its type, and decide whether empty values are acceptable. For example, a reporting app might expect a short summary, a list of key points, a sentiment label, and action items. Those are illustrative names—not API-prescribed fields. Use different names or types if your application requires them.

As an Amazon Associate I earn from qualifying purchases.

Also decide how your code should handle missing information. A string might be allowed to be empty, or the schema might need to restrict its possible values; an array might allow zero items. These choices affect downstream behavior, so do not leave the model to invent keys or infer the contract from a prompt.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Represent the contract in JSON Schema

The following is a schematic response-format fragment showing four properties. It is not a complete API request, and its example fields are not an official or universally suitable schema. Confirm the request envelope and supported schema keywords for the endpoint and SDK you use.

{
  "text": {
    "format": {
      "type": "json_schema",
      "name": "four_field_summary",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "summary": { "type": "string" },
          "key_points": { "type": "array", "items": { "type": "string" } },
          "sentiment": { "type": "string" },
          "action_items": { "type": "array", "items": { "type": "string" } }
        },
        "required": ["summary", "key_points", "sentiment", "action_items"],
        "additionalProperties": false
      }
    }
  }
}

In this illustration, the root is an object; properties describes the four keys and their types; required lists all four; and additionalProperties: false expresses that no other keys belong in the object. The example assumes those schema features are accepted in the selected strict mode—verify that against the current supported subset before relying on it. The response-format reference documents a name, schema, optional description, and strictness setting; it limits the format name to 64 characters and allows letters, digits, underscores, and dashes.

Choose schema-constrained output or JSON mode

Use json_schema when the application needs a particular object shape and the selected model supports it. The API reference says this response format enables Structured Outputs intended to match the supplied schema. By comparison, the older json_object mode ensures valid JSON; that is useful when parseable JSON is enough, but it is not the documented equivalent of matching an explicit schema. See the OpenAI API response-format reference for the current distinction and format details.

Strictness is a separate choice within schema output. Setting strict: true requests strict schema adherence, but strict mode supports only a subset of JSON Schema. Avoid depending on advanced schema constructs until you have confirmed that the API accepts them. The Structured Outputs guide describes the supported feature set.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Implement the response handling at the application boundary

  1. Define the contract. Record the exact four keys, value types, empty-value policy, and downstream handling for missing or ambiguous source information.
  2. Encode that contract. Add the object, property schemas, required-key behavior, and additional-property policy using features supported by the selected API mode.
  3. Select the response format. Use the endpoint’s documented json_schema format when supported. Use json_object only when valid JSON, rather than a fixed schema shape, meets the requirement.
  4. Read the current response representation. Parse the returned text or structured output according to the current endpoint or SDK documentation; do not assume this schematic fragment is a full request or response example.
  5. Handle non-result outcomes. Account for refusals, incomplete responses, API errors, and parsing or validation failures as described for the endpoint. A successful HTTP response alone does not establish that your application has a usable summary.
  6. Validate and test locally. At the application boundary, check that all four keys are present and values have the expected types. Exercise empty and ambiguous inputs, and test the failure paths your application depends on.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify version and model support before shipping

API examples are implementation details, not timeless guarantees. Check the current create-response documentation and the SDK documentation for the endpoint envelope, response parsing, model support, and strict-mode schema subset in your actual integration. The example above illustrates the schema concept; it is not a tested endpoint-specific four-field implementation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.