AI · 10 — Output parser (LLM → valid JSON)
LLMs return prose; pipelines need JSON. The ◈-wired Chat is told to answer in JSON, and the Output Parser turns that answer (even when it is wrapped in prose or code fences) into a validated object downstream nodes can use.
What’s inside
5 nodes — every type links to its full reference page.
| Step | Node | Type |
|---|---|---|
| Question | Inject | input.inject |
| Ask for JSON | AI Prompt | ai.prompt |
| Ollama (local) | AI Model | ai.model |
| Parse | Output Parser | processing.output-parser |
| Parsed object | Console | utility.console |
Import it
- Studio → Import — paste the JSON below (or the URL
/docs/templates/ai-10-output-parser-llm-valid-json.json). - Or ask the AI Copilot with the JSON pasted after the phrase:
import this workflow json into a new workflow named "AI · 10 — Output parser (LLM → valid JSON)" - Any credentials the nodes need are
${credential.…}references — add them once in Admin → Credentials and the template picks them up. Nothing secret ships in a template.
The workflow document (flowdrome.workflow.v1, 5 node types)
{
"schemaVersion": "flowdrome.workflow.v1",
"id": "",
"name": "AI · 10 — Output parser (LLM → valid JSON)",
"version": "0",
"status": "draft",
"nodes": [
{
"id": "seed",
"type": "input.inject",
"label": "Question",
"category": "trigger",
"config": {
"contentType": "application/json",
"payload": {
"question": "Name the capital of France and its country."
}
},
"position": {
"x": 0,
"y": 0
}
},
{
"id": "ask",
"type": "ai.prompt",
"label": "Ask for JSON",
"category": "ai",
"config": {
"provider": "ollama",
"baseUrl": "",
"apiKey": "",
"model": "qwen2.5:1.5b",
"systemPrompt": "Reply with ONLY a JSON object exactly like {\"city\":\"...\",\"country\":\"...\"} — no prose, no markdown.",
"promptMode": "field",
"promptField": "question",
"temperature": "0",
"maxTokens": 100,
"jsonMode": false,
"timeoutMs": 120000
},
"position": {
"x": 530,
"y": 0
},
"attachments": {
"model": "llm"
}
},
{
"id": "llm",
"type": "ai.model",
"label": "Ollama (local)",
"category": "ai",
"config": {
"provider": "ollama",
"baseUrl": "",
"apiKey": "",
"model": "qwen2.5:1.5b",
"models": [],
"temperature": 0.2,
"maxTokens": 512
},
"position": {
"x": 530,
"y": 222
}
},
{
"id": "parse",
"type": "processing.output-parser",
"label": "Parse",
"category": "ai",
"config": {
"inputField": "reply",
"mode": "json",
"errorOnInvalid": false
},
"position": {
"x": 1060,
"y": 0
}
},
{
"id": "out",
"type": "utility.console",
"label": "Parsed object",
"category": "utility",
"config": {
"message": "valid={{ $json.valid }} city={{ $json.parsed.city }} country={{ $json.parsed.country }}"
},
"position": {
"x": 1590,
"y": 0
}
}
],
"edges": [
{
"id": "e0",
"sourceNodeId": "seed",
"sourcePort": "output",
"targetNodeId": "ask",
"targetPort": "input"
},
{
"id": "e1",
"sourceNodeId": "ask",
"sourcePort": "output",
"targetNodeId": "parse",
"targetPort": "input"
},
{
"id": "e2",
"sourceNodeId": "parse",
"sourcePort": "output",
"targetNodeId": "out",
"targetPort": "input"
}
],
"triggers": [
{
"id": "t0",
"nodeId": "seed"
}
],
"meta": {
"snippets": [],
"source": "template-gallery",
"description": "LLMs return prose; pipelines need JSON. The ◈-wired Chat is told to answer in JSON, and the Output Parser turns that answer (even when it is wrapped in prose or code fences) into a validated object downstream nodes can use."
}
} Generated from the verified demo corpus — this exact document seeds and runs on a fresh Flowdrome. Raw JSON: ai-10-output-parser-llm-valid-json.json.