JSON Writing
Append text output to a file across loop iterations
- file_path
The name says "JSON," and the category - iterator, right alongside json_iterator - tells you why: this is the logging half of this pack's loop pattern. Iterate over a list with json_iterator, process each item, and use this node to write the result out to a file, one entry at a time, building up a results file across the whole loop.
Don't take the name too literally, though. Look at the actual input and it's just text - a plain string. This node doesn't parse or enforce JSON structure at all; it writes whatever text you hand it. If you want the resulting file to actually be valid JSON, that's on you (and on json2text or your LLM's own output) to produce upstream - this node's job is purely "put this string into this file."
How it works
Give it text and a file path, and it writes the text to that file. The mode setting controls how repeated writes accumulate.
The inputs and outputs that matter
text- the content to write. Despite the node's name, this is a generic string, not something the node parses as structured JSON.file_path(default empty) - where to write it. Has to be set explicitly.mode-extendorappend. Both read as "add to the file rather than overwrite it," and the schema doesn't spell out a sharper distinction between the two - if it matters whether you're getting a clean line-by-line append versus something that behaves differently, test both against a throwaway file before trusting either with a real run's results.is_enable- standard bypass toggle.
Output: file_path (STRING) - echoes the path back out, useful for chaining into another node that needs to know where the file ended up. This node is also an output node, so ComfyUI runs it every execution regardless of whether anything consumes its output - the actual point is the write, not the returned path.
How to install it
Via ComfyUI Manager: search comfyui_LLM_party, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/heshengtao/comfyui_LLM_party.git
Then pip install -r requirements.txt from inside the pack folder using ComfyUI's own Python, and restart. No models or API keys needed - pure local file I/O.
Common issues & troubleshooting
The file gets overwritten instead of growing. If you're expecting results from multiple loop iterations to accumulate and instead only the last one survives, you've likely got the wrong mode for your case, or file_path is pointing somewhere getting cleared between runs (check that FolderCleaner, if you're using it, isn't wiping the same folder this node writes into).
Running on a hosted/cloud executor and the file "disappears." Same caveat as this pack's other file-writing nodes: the path is local to wherever the node executes, which on a cloud worker is ephemeral container storage, not somewhere you can browse afterward. If you need the accumulated results out of the run, that has to happen through a real output/delivery step, not by revisiting the path later.
You wanted valid JSON out and got something that doesn't parse. Expected, given the node writes raw text - make sure whatever's feeding text is already correctly JSON-formatted (via json2text or a carefully prompted LLM output) before it reaches this node, since json_writing won't fix or validate it for you.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| file_path | STRING | — | |
| mode | COMBO | extend | 2 options: extend, append |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_path | STRING | — |