Primitive Value Converter¶
Converts an input value into a specified primitive type: STRING, INT, FLOAT, BOOLEAN, LIST, or DICT. Supports parsing of simple list/dict strings, optional casting of elements inside collections, and targeted extraction by index or key when outputting a single string. Includes safe fallbacks and formatting to reduce errors during data preparation.

Usage¶
Use this node whenever you need to normalize or transform incoming data into a specific primitive type for downstream nodes. Typical flows include: turning user or tool outputs into structured lists/dicts, coercing numeric or boolean values, extracting a single element from a list/dict as a string, or pretty-printing any input as a JSON string.
Inputs¶
| Field | Required | Type | Description | Example | 
|---|---|---|---|---|
| input_value | True | WILDCARD | The value to convert. Accepts any type, including strings, numbers, booleans, lists, and dicts. Strings can represent comma-separated lists or key:value pairs. | a:1, b:2, c:3 | 
| output_type | True | ENUM[STRING\|INT\|FLOAT\|BOOLEAN\|LIST\|DICT] | Target type for the conversion. Determines the final shape of the output. | LIST | 
| sub_data_type | False | ENUM[ORIGIN\|STRING\|INT\|FLOAT\|BOOLEAN] | For LIST/DICT outputs and for element extraction, controls how individual elements/values are cast. ORIGIN preserves original types. | INT | 
| index_or_key | False | STRING | When extracting a specific element to STRING output: provide a zero-based index for lists or a key for dicts. If omitted and output_type is STRING, the entire input is returned as a formatted JSON string. | 0 | 
Outputs¶
| Field | Type | Description | Example | 
|---|---|---|---|
| output | WILDCARD | The converted value in the requested type. For STRING outputs without index_or_key, the whole input is JSON-formatted. For LIST/DICT outputs, elements/values can be cast using sub_data_type. | [1, 2, 3] | 
Important Notes¶
- Index or key extraction applies when output_type is STRING. If provided, the node attempts to extract that element from a list/dict and cast it using sub_data_type.
- If index_or_key is empty and output_type is STRING, the entire input is returned as a pretty JSON string.
- For LIST/DICT outputs, sub_data_type controls casting of elements/values. Use ORIGIN to preserve original types.
- String parsing supports simple CSV lists (e.g., "a,b,c") and comma-separated key:value pairs (e.g., "a:1, b:2"). It also understands basic multiline formats like "key: value" per line or list items prefixed with '-' or '1)'.
- On conversion errors (e.g., bad index/key or incompatible casting), the node returns a safe default for the target type (e.g., empty string for STRING, [] for LIST, {} for DICT) and logs a warning.
- Boolean casting follows a sanitizer that interprets common truthy/falsey string forms.
Troubleshooting¶
- Getting an empty string when extracting from a list/dict: Verify index_or_key is valid (0-based index for lists, existing key for dicts) and that output_type is STRING.
- LIST/DICT output not as expected: Check sub_data_type to ensure elements are being cast correctly (e.g., set to INT for numeric lists).
- Parsed list/dict is empty from a string: Ensure the input string uses supported formats (comma-separated items, key:value pairs, or multiline with '-' or 'key: value').
- Unexpected numeric conversion results: If input values contain decimals and you selected INT, they are truncated by casting via float first. Choose FLOAT if you need decimals.
- Boolean not converting: Ensure your input uses recognizable truthy/falsey representations (e.g., true/false, yes/no, 1/0).