Nodes/ComfyUI-YogurtNodes/Serialize Any (Yogurt Nodes)
ComfyUI Node

Serialize Any (Yogurt Nodes)

Stuff any Python object into a bytes file

By yogurt7771·Created 2 years ago·Updated 9 days ago· 1
Serialize Any (Yogurt Nodes)
  • data
  • bytes_data

Serialize Any is the pack's "turn this into bytes" node, and it's the boring half of a very useful pair. It takes whatever Python object you hand it - a dict, a list, a string, an arbitrary custom node result - and serializes it with pickle, the Python standard library's binary object format. What comes out is a BYTES value you can save to a file, ship over the network, or stash for later.

The node itself is one input, one output: data (type *, meaning it accepts anything) goes in, bytes_data (type BYTES) comes out. That's the entire surface. Its natural partner is Deserialize Any, which unpickles the bytes back into the object, and the pack's Save Bytes Bridge / Load Bytes nodes, which get the bytes onto and off of disk. Together they give you something ComfyUI doesn't have natively: a way to persist an arbitrary object and reconstruct it exactly later, not just a rendering of it.

Why you'd reach for it

The moment this becomes useful is when you have a complex object - a nested dict from an API call, a configuration blob assembled mid-workflow, a list-of-lists that would be painful to rebuild - and you want it out of the current run and back in the next one. Serialize to bytes, Save Bytes Bridge to a file, then Load Bytes → Deserialize Any on the other side. It's the round-trip mechanism for "keep this thing for later" without losing its structure.

Install

One pack, one install:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

or ComfyUI Manager → ComfyUI-YogurtNodes → install → restart. It sits under Yogurt Nodes → IO.

The honest caveats

Pickle is a blunt instrument and you should treat it accordingly. First, it's not portable across environments - a pickle produced by one Python version may fail to unpickle on another, and it absolutely won't read outside Python. If the data is going anywhere else, use JSON (the pack's JsonStringify/JsonParse cover that) instead of pickle. Second, never unpickle untrusted data: pickle can execute arbitrary code on load, which is the same class of footgun as installing a sketchy custom node. Only round-trip pickles you made yourself in the same environment. Third, don't try to serialize heavyweight tensors or model objects through this and expect it to be a checkpoint format - it isn't. Keep it for plain data structures and you'll be fine.

CategoryYogurtNodes/IO

Inputs (1)

NameTypeDefaultDescription
data*The data to be serialized using pickle.

Outputs (1)

NameTypeDescription
bytes_dataBYTES