Convert Any(convertAnything)
Convert Any (class convertAnything) is a logic utility node that takes an input of any type and converts it to a selected primitive type.
convert Anything
Convert Any (class convertAnything) is a logic utility node that takes an input of any type and converts it to a selected primitive type. It is useful for normalizing values when a downstream node expects a specific type such as a string, integer, float, or boolean.
Inputs
*
- Type:
ANYTYPE - Required: Yes
The universal input accepts any data type. Connect the value you want to convert here.
output_type
- Type:
COMBO - Required: Yes
- Default:
"string" - Options:
"string","int","float","boolean"
Select the target type for the conversion. The output will be returned as this type.
Outputs
Converted value
- Type:
ANYTYPE
The input value after conversion to the selected output_type.
Usage Notes
Use this node as a flexible type adapter when a connection produces a value of an unexpected type. The wildcard * input lets it accept nearly any value without prior type checking, making it easy to insert directly into logic chains.
Conversion behavior follows standard Python casting rules for the selected primitive type. For example, numeric strings such as "42" can be converted to integer or float, and numbers are converted to their string representation when output_type is string.
When converting to boolean, keep in mind that the result is based on the truthiness of the input value. Non-empty strings and non-zero numbers generally become True, while empty strings and zero become False. If you need precise text-to-boolean parsing, convert the value to a string beforehand or use a more explicit comparison node.
Comments
Sign in with GitHub to join the discussion.