Convert to String (Custom)
Convert anything to text and stop fighting type-mismatch errors
- input
- output_str
The type-mismatch escape hatch
ComfyUI is picky about socket types. An INT output won't plug into a STRING input, and half your early workflow errors are exactly that - a seed that needs to be text, a counter that belongs in a filename, a number you want printed on the canvas. brkp_ConvertToString is the "just make it a string" node. One input that accepts anything, one text output. That's the entire job, and it's genuinely the node you'll reach for more than you expect.
How it works
The input is declared with the wildcard type *, which is ComfyUI's way of saying "any socket fits here." Feed it a number, a string, a bool, a dict, whatever. What happens next depends on what it got, and the source is worth knowing:
- A string passes straight through untouched.
- An int, float, or bool becomes its plain text form (
42,3.14,True). - Anything else that's truthy - dicts, lists, tuples - gets serialized as compact JSON (no extra spaces) via
json.dumps. - Falsy values like
Nonebecome an empty string.
So a single integer in gives you "42" out, and a small dict in gives you {"a":1,"b":2}. If serialization fails on something weird, it falls back to Python's plain str(), which for tensors and images means an unhelpful repr - this node is made for scalars and small structures, not debugging your latent tensor.
What you'll wire it into
Output output_str is a STRING, and the classic use is filename building. Pair it with the pack's brkp_ConcatenateString: convert your seed INT to text, then glue it into a filename prefix alongside a date. It's also a cheap debugging tool - pipe any mystery value through it and read what's actually coming down the wire.
Installing it
Part of barakapa-nodes, installed once for all six nodes. Via ComfyUI Manager: search barakapa → install → restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/barakapa/barakapa-nodes
Then restart ComfyUI. No models to download, no dependencies beyond ComfyUI's own - just a small pure-Python utility pack.
Gotchas
Nothing dramatic. Remember that None (unconnected or empty optional inputs) becomes an empty string, not "None" - which is actually convenient for filename work. And if you're feeding it JSON, the output is compact and key-sorted only if the input happened to be that way; don't expect pretty formatting. Otherwise, it's one of those nodes that's boring in the best way: it does one thing, does it right, and gets out of your way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output_str | STRING | — |