I am using AI Agents in n8n and needed to output JSON. Of course, LLM outputs text, which I then parse to JSON.
However, Even with clear prompt (output JSON only) I noticed inconsistent results.
Example
- I need from AI to go to link and parse content
- Create article TEXT from that content
- Create article TITLE from that content
- Assign meaningful tags (i.e. from Google Sheet predefined tags list)
- Output this as JSON ({contenwt: "...", title: "...", tags: ["..."]}).
What is your approach in case you need JSON output from LLM?
Should I use different agents for each part (title, content, tags,...) and then Merge it?