Parse Structured JSON Output

Use structured output parsing when later workflow steps need predictable fields.

The Structured Output Parser defines the JSON shape expected from an AI Agent reply. You can generate a schema from an example JSON object or enter a JSON Schema manually. The parser validates its configuration and can ask a connected model to correct a response that does not match the schema.

Screenshot to add: Structured Output Parser configuration with Schema Type and JSON Example fields

Add a structured output parser

  1. Select the AI Agent node and enable Require Specific Output Format.
  2. Add a Structured Output Parser attachment on the canvas.
  3. Select the parser node to open its configuration.
  4. Choose a schema method and define the expected fields and data types.
  5. Test the parser configuration and resolve any schema validation errors.

Choose a schema method

Use Schema Type → Generate From JSON Example to provide a sample object in JSON Example. The parser derives a schema from that example, and all properties are required. If some fields should be optional, choose Define using JSON Schema and enter a schema in the Input Schema field instead. The manual JSON Schema input does not support $refs.

Screenshot to add: Structured Output Parser showing Define using JSON Schema and the Input Schema field

Configure automatic format correction

Auto-Fix Format is enabled by default. If the agent reply does not match the schema, the parser can ask a connected model to correct it once. Connect a model under the parser node to enable this correction step.

Enable Customize Retry Prompt to edit the Retry Prompt used for the correction attempt. The supported placeholders are {instructions}, {completion}, and {error}. Leave this option disabled to use the built-in retry prompt.

Test the expected structure

  • Use valid JSON for the example or schema input.
  • Check field names and types against the data the next workflow step expects.
  • Test missing, invalid, and unexpected values where relevant.
  • Remember that schema validation and optional auto-fix reduce formatting problems but do not guarantee that the model’s content is factually correct.