I’m building a workflow that takes CSV data, passes it through an LLM, and adds two new fields (score and rationale) back to the output. The workflow runs fine in the app, but the CSV export is combining these fields instead of placing them in separate columns.
Workflow structure:
Input Block → LLM Block → Output Block
Structured output configuration (LLM block):
Copy code
{
"score": <integer 1-5>,
"rationale": "<explanation>"
}
Current CSV output:
| completed output |
| {“rationale”:“…”,“score”:“5”} | |
Desired CSV output:
| rationale | score |
| This is dummy rationale. | 5 |
Each input row should produce one output row with the original columns plus these two new columns in their own cells, not as a combined JSON object.
I’m using Dify’s built-in CSV export. I haven’t modified the output block configuration beyond adding the structured output variables.
What am I missing here?
This usually happens when the workflow is still treating your structured output as a single JSON object instead of separate mapped fields during the export step.
Even though your LLM is correctly returning:
{
"score": 5,
"rationale": "..."
}
the CSV exporter in many workflow tools (including Dify setups) won’t automatically “flatten” that object unless you explicitly map the fields in the Output node.
What typically fixes it:
-
In your Output Block, don’t pass the whole structured object
-
Instead, reference each field individually, e.g.:
If you only pass something like {{llm.output}}, it will stay bundled as JSON and end up in a single CSV column.
Also worth checking:
-
Whether “structured output” is enabled only for parsing, not for export formatting
-
Whether you need a “flatten / transform variables” step before output
I’ve seen a similar workaround explained on a helpful reference website here:
Once the fields are explicitly mapped in the output layer, the CSV export should generate proper separate columns like you expect.