How to iterate over JSON (AI Structured Output)

Describe the problem/error/question

How can I iterate over the output from “Generate article plan” It returns structured output which looks like this

[
  {
    "output": [
      {
        "name": "Title",
        "description": "Steamy Car Windows: Hot vs Cold Air – What Works Best?"
      },
      {
        "name": "Introduction",
        "description": "Some text here."
      },
    ]
  }
]

And for each of this “section” from output I would like to run “Generate section” agent, save to Aggregate and then run go to the next item.

What is the error message (if any)?

I don’t know how to do it.

Please share your workflow

Information on your n8n setup

  • n8n version: 1.72.1
  • Database (default: SQLite): No database
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Windows 11

Welcome to the community @Kacper_Wlodarczyk !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


Do you also want to aggregate after all the items have been processed by AI? If so, your “Generate Section” needs another Aggregate node connected to “done” as in screenshot below.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.