Nodes/LF Nodes/Convert to string
ComfyUI Node

Convert to string

Every string conversion you'd ever want, in one node

By lucafoscili·Created 2 years ago·Updated 2 years ago· 50
Convert to string
  • json
  • ui_widget
  • json
  • boolean
  • float
  • integer
  • json_boolean
  • json_float
  • json_integer
  • boolean_float
  • boolean_integer
  • float_integer
  • json_boolean_float
  • json_boolean_integer
  • json_float_integer
  • boolean_float_integer
  • json_boolean_float_integer
separator,
boolean
float
integer

Fifteen outputs. That's the first thing you'll notice about LF_Something2String, and it's worth explaining because it's not bloat - it's the node pre-solving every conversion combination so you never have to chain converters. You feed it any mix of a json, boolean, float, and integer, and it gives you a string version of every non-empty combination of those inputs: just json, just boolean_float, all the way up to json_boolean_float_integer. Whatever subset of inputs you actually connected, there's an output named for exactly that subset, pre-joined with your separator.

The one required input is separator - the character(s) used to glue values together, defaulting to ", ". That's the hidden control that shapes everything: with the default you get comma-joined strings, but switch it to an empty string and you get concatenation, or use a space, a pipe, whatever your downstream format demands. It's also the source of the most common "why is my output weird" moment: forget you left separator as something odd and your combined string comes out looking scrambled.

Mechanically it's the mirror image of the pack's LF_Something2Number - type coercion the other direction. Booleans become "True"/"False" (Python-style), numbers stringify naturally, and JSON gets serialized to its text form. Each output is independently computed from the inputs you've connected, so you can, for example, connect boolean and integer and read boolean_integer ("True, 42") while ignoring the other thirteen unused outputs.

Where this earns its place is prompt and filename building. If you're assembling a filename from a boolean flag, a float weight, and an integer seed, this node hands you the combined string in one go instead of a chain of string-append nodes. Same for turning structured data into a line for a caption file, or formatting values for display. It's a "data plumbing" node, which is not glamorous - but ComfyUI is full of small chores, and this one kills a whole family of them in a single node.

A word of caution if you're type-snobbish: "True" is the Python boolean spelling, and the JSON serialization follows Python's JSON defaults (like null and lowercase true inside the JSON string). If you need JavaScript-style casing or a different number format, you'll be post-processing - this node converts, it doesn't localize.

Install: ComfyUI Manager → "LF Nodes", or git clone https://github.com/lucafoscili/comfyui-lf into custom_nodes, then restart. And the pack note that follows this whole family: comfyui-lf is frozen in legacy mode (fully functional) with active development in lucafoscili/lf-nodes.

Category✨ LF Nodes/Primitives

Inputs (6)

NameTypeDefaultDescription
separatorSTRING, Character(s) separating each string apart.
jsonoptJSONJSON value to convert to string.
booleanoptBOOLEANBoolean value to convert to string.
floatoptFLOATFloat value to convert to string.
integeroptINTInteger value to convert to string.
ui_widgetoptKUL_CODE

Outputs (15)

NameTypeDescription
jsonSTRING
booleanSTRING
floatSTRING
integerSTRING
json_booleanSTRING
json_floatSTRING
json_integerSTRING
boolean_floatSTRING
boolean_integerSTRING
float_integerSTRING
json_boolean_floatSTRING
json_boolean_integerSTRING
json_float_integerSTRING
boolean_float_integerSTRING
json_boolean_float_integerSTRING