---
title: Structured Output Parser
description: Return data in a defined JSON format
---

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

## What it does

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.

## When to use it

* 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](/nodes/builtin/ai/aidependencies/outputparser/autofixingoutputparser/) in front of it.

For a plain list of words, [Item List Output Parser](/nodes/builtin/ai/aidependencies/outputparser/itemlistoutputparser/) is simpler.

## Inputs and settings

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:

```json
{
  "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.

## Outputs

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

* **Output Parser** slot of [Tools Agent](/nodes/builtin/ai/aiagents/toolsagentnode/), [Q\&A Agent](/nodes/builtin/ai/aiagents/qanode/), [RAG Agent](/nodes/builtin/ai/aiagents/ragnode/), [Basic LLM Chain](/nodes/builtin/ai/aiagents/basicllmchainnode/), [Information Extractor](/nodes/builtin/ai/aiagents/informationextractornode/)
* **Base Parser** slot of [Auto-fixing Output Parser](/nodes/builtin/ai/aidependencies/outputparser/autofixingoutputparser/)

The data appears on the node it is plugged into. On [Basic LLM Chain](/nodes/builtin/ai/aiagents/basicllmchainnode/) and the agents, `response` becomes an object, so you can read single fields downstream, for example `{{ $input.response.email }}`. On [Information Extractor](/nodes/builtin/ai/aiagents/informationextractornode/) the object is in `extracted`.

## Dependencies and credentials

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

## Example workflow

1. [Get Selected Text](/nodes/extension/getselectedtext/) reads an email signature you highlighted, with **Output field name** `text`.
2. [Basic LLM Chain](/nodes/builtin/ai/aiagents/basicllmchainnode/) with **Prompt** `Extract the contact details from: {{ $input.text }}`. Connect an [OpenAI](/nodes/builtin/ai/aidependencies/llm/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](/nodes/extension/displaymarkdown/) with **Content** `{{ $input.response.name }} works at {{ $input.response.company }}`.

## Common issues

* **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](/nodes/builtin/ai/aidependencies/outputparser/autofixingoutputparser/).
* **A field has the wrong type.** The type comes from the example value: write `30`, not `"30"`, if you want a number.

## Related nodes

* [Auto-fixing Output Parser](/nodes/builtin/ai/aidependencies/outputparser/autofixingoutputparser/): retry with a model when the JSON is broken.
* [Item List Output Parser](/nodes/builtin/ai/aidependencies/outputparser/itemlistoutputparser/): get a simple list instead.
* [Information Extractor](/nodes/builtin/ai/aiagents/informationextractornode/): pull named fields out of text.
* [Basic LLM Chain](/nodes/builtin/ai/aiagents/basicllmchainnode/): one prompt, one structured answer.