Convert String To Bool [LP]
Turning text into a real boolean
- BOOLEAN
Takes a piece of text and turns it into a proper BOOLEAN - the socket type ComfyUI actually uses to drive switches, conditions, and gates. It's the conversion half of a pairing with BoolToString-LP, and it shows up whenever a boolean-shaped value has been living as plain text somewhere upstream.
Why you'd need this
A BOOLEAN and a STRING that says "true" look the same to you, but ComfyUI's type system doesn't let one plug into the other. This comes up constantly in the loop-and-condition style automation this whole pack leans toward: a config value read from a file, a flag baked into a text template, a value parsed out of a JSON field as text - all of it arrives as a STRING, and if you need it to drive an actual conditional branch or a boolean-only widget downstream, you need this conversion first.
How it works
The node isn't documented down to the exact parsing rule, so it's worth knowing what to watch for rather than assuming. The safe, common convention for this kind of node across the ComfyUI ecosystem is a case-insensitive check against something like "true" / "1" - but if this is instead a bare Python bool(my_string), there's a classic trap: any non-empty string is truthy in Python, so typing the literal word "False" would still evaluate to True, because it's a non-empty string. The only way to know for certain which behavior you've got is to test it once with a Show Boolean or similar node - type "false" in, see what comes out, before you build logic that depends on it.
The inputs and outputs that matter
- string - the text to convert, a single-line STRING defaulting to empty.
- Output - a single BOOLEAN.
One input, one output - the whole surface is that one string field.
How to install it
ComfyUI Manager: search "ComfyUI Level Pixel" or the repo ComfyUI-LevelPixel, install, restart - updates automatically via Manager's "Update ALL." Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git
Restart ComfyUI. Pure text-to-bool logic, nothing else to install.
Common issues & troubleshooting
You typed "false" and got True out. This is the truthy-string trap described above. If it happens, don't fight the node - pre-check for the literal word with a text-compare node upstream, or just verify the parsing rule once and remember it going forward.
Empty string comes in and you're not sure what you'll get. The default is empty, and depending on the parsing rule that could resolve to False (nothing there) either way - verify it directly rather than assuming, since an unconnected upstream text field silently defaulting to the "wrong" boolean is an easy bug to miss in an automated pipeline.
You need the reverse conversion. That's BoolToString-LP in the same pack - boolean in, text out - for when you need to go the other direction, say to build a log message or a filename fragment out of a flag's current state.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |