Skip to content
Agentic Workflowdocs
v0.8.2Install free

nodes / builtin / ai / aidependencies / outputparser

Structured Output Parser

Return data in a defined JSON format

AI ExtensionWeb app

Make an AI node answer with JSON in the exact shape you give as an example.

Structured Output Parser is not a step on its own: it has no output port and never runs by itself. You plug it into the Output Parser slot of an AI node, and that node uses it.

From your JSON Output Example, the parser works out the fields and their types (text, number, true/false, lists, nested objects). The AI node then adds formatting instructions to what it sends the model, asking for JSON in that shape. When the reply comes back, the parser reads it and checks it against the shape, so the AI node returns real data instead of text.

  • Turn free text into fields you can use later, such as a name, an email and a company.
  • Get a fixed set of values back, for example { "sentiment": "positive", "score": 0.9 }, to route with an If or Switch.
  • When the model sometimes breaks the JSON, put an Auto-fixing Output Parser in front of it.

For a plain list of words, Item List Output Parser is simpler.

SettingTypeWhat it does
JSON Output Example (required)CodeAn example of the JSON output you expect. Default: { "name": "John", "age": 30 }

Write a real example, not a description. The value types matter more than the values: "John" means text, 30 means a number, true means true/false, ["a"] means a list of text. For example:

{
"name": "Ada Lovelace",
"email": "ada@example.com",
"company": "Analytical Engines",
"interested": true
}

The example must be valid JSON: double quotes around names and text, no trailing commas, no comments.

This node has no output port. It plugs into a slot on another node instead of passing items along.

The data appears on the node it is plugged into. On Basic LLM Chain and the agents, response becomes an object, so you can read single fields downstream, for example {{ $input.response.email }}. On Information Extractor the object is in extracted.

None. This node needs no connection and has no slots for other nodes.

  1. Get Selected Text reads an email signature you highlighted, with Output field name text.
  2. Basic LLM Chain with Prompt Extract the contact details from: {{ $input.text }}. Connect an OpenAI model to its Model slot.
  3. Structured Output Parser connected to the Output Parser slot of Basic LLM Chain, with JSON Output Example { "name": "Ada Lovelace", "email": "ada@example.com", "company": "Analytical Engines" }.
  4. Display Markdown with Content {{ $input.response.name }} works at {{ $input.response.company }}.
  • The run fails with a JSON error such as “Unexpected token” before the model is called. JSON Output Example is not valid JSON. Fix the quotes and commas.
  • “Failed to parse”. The model’s reply was not JSON in the expected shape. Use a stronger model, simplify the example, or wrap this parser in an Auto-fixing Output Parser.
  • A field has the wrong type. The type comes from the example value: write 30, not "30", if you want a number.
Edit page

Last updated:

Was this page useful?
Ask Aria about Structured Output Parser