MF Save Data (json/csv/xml/yaml)
Persist any string as JSON, CSV, XML or YAML — LLM output, configs, state
- filepath
ComfyUI's "Save Image" is great at pixels and useless at everything else. When you want to persist a prompt, a config, an API response, or an LLM's output to disk, MF Save Data (json/csv/xml/yaml) (MF_SaveData) is the writer half of MF PipoNodes' data pair - take any string, pick a format, and write a real file. From the MF PipoNodes pack (pierreb-mf / Moment Factory).
How it works
Four required inputs, all of which you'll set:
data- the string to save (marked as a forced input, so it takes a wire rather than hand-typing).output_path- the directory, default"output"(relative to ComfyUI's working directory, so usuallyComfyUI/output). It's created automatically if missing.filename- base name without extension, default"data".format- enum:json,xml,csv,yaml.
One output: filepath (STRING) - the full path of the file you just wrote.
The format handling is "try to be smart, degrade gracefully":
- JSON - parses your string and re-dumps it pretty-printed; if it isn't valid JSON, writes it as-is.
- CSV - if your data parses as a list of objects, writes header + rows; otherwise writes the whole string as one cell.
- XML - parses and pretty-prints, or wraps the raw text in a
<data>element. - YAML - parses as JSON first, then dumps to YAML; needs
pyyaml(it's in the pack's requirements).
There's one genuinely useful nicety: the node strips markdown code fences from the input before writing. So when an LLM returns ```json ... ```, the fences vanish and you get a valid file. That alone saves a regex node.
The pattern it exists for
The obvious one: an LLM node outputs a JSON string, and you want it on disk as actual JSON for another tool.
LLM node ──▶ MF Save Data (format: json) ──▶ filepath ──▶ log it or display it
Pair it with MF Read Data for the full persist-and-reload loop: save settings at the end of a run, load them back at the start of the next. And it's the natural audit trail complement to MF Save Log File when you want structured output instead of a timestamped text file.
Install
cd ComfyUI/custom_nodes/
git clone https://github.com/pierreb-mf/ComfyUI-MF-PipoNodes
cd ComfyUI-MF-PipoNodes
pip install -r requirements.txt
Restart after, or ComfyUI Manager → "MF PipoNodes". Only aiohttp and pyyaml are pulled in.
Gotchas
- Relative
output_pathis relative to the ComfyUI process, not to the pack or your home."output"lands inComfyUI/output, which is almost always what you want - just don't assume absolute paths. - "Smart" parsing can surprise you. Feed valid JSON into
format: jsonand it gets re-serialized (that's fine). Feed almost-valid JSON and the fallback writes it verbatim, so the file may still be invalid when another tool opens it. - Errors come back through
filepath- on failure the output is a string like"Error: ...", so check it before wiring it into a path.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| data | STRING | — | |
| output_path | STRING | output | — |
| filename | STRING | data | — |
| format | COMBO | 4 options: json, xml, csv, yaml |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filepath | STRING | — |