Nodes/JNComfy/TO BOOLEAN
ComfyUI Node

TO BOOLEAN

Coerce literally anything to true or false

By jn-jairo·Created 2 years ago·Updated 2 years ago· 5
TO BOOLEAN
  • value
  • BOOLEAN

ComfyUI is picky about wire types: an INT output usually can't just plug into a socket that specifically wants BOOLEAN, even if the number is obviously a 0 or a 1. This node is the cast that bridges that gap - feed it anything, get a real BOOLEAN out, ready to wire into whatever's actually asking for one (a gate, a conditional branch, whatever the pack's workflow nodes use to decide which way to go).

It's from JNComfy (jn-jairo/jn_comfyui), a one-person pack of audio tools, face restoration, sampling extensions, and this family of small conversion primitives. There's no meaningful community discussion of the pack anywhere - it's a personal toolkit made public, so the README and the schema are genuinely the whole reference.

How it works

The value input is typed generically, which is what lets it accept anything in the first place - a number, a string, another JN array, whatever's on hand. The conversion itself is ordinary truthiness, the same rule Python (and this pack's own JN_FirstActive, which checks for "active" values the same way) uses everywhere: 0, "" (empty string), None, and empty arrays all come out false; anything with actual content comes out true.

The trap worth naming explicitly: this is a truthiness cast, not a text parser. Feed it the literal string "false" and you get true back - a non-empty string is still truthy, regardless of what the text inside it says. If you need "the text says false, so make it BOOLEAN false," this node doesn't do that; you'd need something that actually parses the string content first.

Where it's genuinely useful is bridging any generically-typed output into a socket that specifically demands BOOLEAN - an upstream node that hands you * rather than a strict type, feeding into a gate or a conditional branch that won't accept anything else. Without a cast in between, ComfyUI's own type checking on a strictly-typed socket can refuse the connection outright.

The inputs and outputs that matter

  • value (required, any type) - what you're casting.
  • Output: BOOLEAN.

Installing it

ComfyUI Manager: search "JNComfy". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui

Restart ComfyUI. No models, no dependencies.

Common issues & troubleshooting

A string like "false" or "0" comes out true. As above - this is truthiness, not text parsing. Any non-empty string is truthy regardless of its content.

A meaningful 0 gets treated as false when you didn't want it to. Same underlying rule - if 0 is a legitimate value in your graph rather than "absent," this node will still read it as false. That may or may not be what you want; test with a JN_Dump on the output if you're unsure.

Expecting the node to validate rather than coerce. It never errors on a weird input - everything maps to something, one way or the other. If you need actual validation (reject bad input rather than silently coercing it), this isn't that node.

CategoryJN/Primitive/Conversion

Inputs (1)

NameTypeDefaultDescription
value*

Outputs (1)

NameTypeDescription
BOOLEANBOOLEAN