Primitive Value Converter¶
Converts an input value between primitive data types (STRING, INT, FLOAT, BOOLEAN, LIST, DICT). Supports element/value casting for collections via a sub-data-type, and optional extraction of a specific element by index or key. Provides safe conversion with sensible defaults and basic parsing for comma-separated and multi-line strings.

Usage¶
Use this node to normalize or transform data between types before passing it to other nodes. Typical workflows include: turning comma-separated strings into lists, parsing simple key:value strings into dicts, casting list elements to a desired type, pretty-printing any value as a JSON string, or extracting a specific item from a list/dict by index/key.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| input_value | True | WILDCARD | The value to convert. Can be a string, number, boolean, list, or dict. Strings may be parsed as lists (comma-separated) or dicts (comma-separated key:value pairs, or multi-line key: value). | name: Alice, age: 30 |
| output_type | True | STRING | Target output type. Options: STRING, INT, FLOAT, BOOLEAN, LIST, DICT. | LIST |
| sub_data_type | False | STRING | When producing LIST or DICT (or when casting elements/values), specifies the type for elements/values. Options: ORIGIN, STRING, INT, FLOAT, BOOLEAN. ORIGIN keeps original element types. | INT |
| index_or_key | False | STRING | For list/dict extraction or when output_type is STRING: provide a zero-based index (for lists) or a key (for dicts) to extract a single item. If set, the node returns only that item (cast according to sub_data_type). | 0 |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| output | WILDCARD | The converted value in the specified output type. For STRING output without index_or_key, returns a pretty-printed JSON string representation of the input. For LIST output, returns a list (dicts become list of values). For DICT output, returns a dict if parsing or casting produced one. | [1, 2, 3] |
Important Notes¶
- STRING output behavior: If output_type is STRING and no index_or_key is provided, the node returns a pretty-printed JSON string of the original input value.
- Element extraction: If index_or_key is provided and the input is a list/dict, the node returns only that element (list index or dict key). On failure, it returns an empty string.
- Sub-data-type casting: Elements and values in lists/dicts are cast using sub_data_type. Use ORIGIN to keep original types.
- String parsing: Comma-separated strings without ':' are parsed as lists; comma-separated 'key:value' pairs (when output_type is DICT) are parsed into dicts; multi-line strings can be parsed as key: value dict entries or as list items (lines starting with '-' or 'n)').
- LIST from dicts: When output_type is LIST and the processed input is a dict, only the dict's values are returned (keys are discarded).
- Error handling: If conversion fails, the node falls back to default base values per type (STRING -> "", INT -> 0, FLOAT -> 0.0, BOOLEAN -> false, LIST -> [], DICT -> {}).
- Unsupported types: If an unsupported output_type is provided (anything other than STRING, LIST, DICT), the node logs a warning and defaults to LIST behavior.
Troubleshooting¶
- Getting an empty string output: If using index_or_key on a list/dict and the index is out of range or the key doesn't exist, the node returns an empty string. Verify the index/key and data shape.
- Unexpected list from a dict: When output_type is LIST, dict inputs become a list of values (keys are removed). If you need key-value pairs, use DICT output.
- String not parsed into dict: Comma-separated key:value parsing only occurs when output_type is DICT. Ensure output_type is DICT and the string uses 'key: value' pairs separated by commas.
- Numbers not converting as expected: If element casting to INT/FLOAT fails for some items, those items may remain uncast (ORIGIN) or trigger defaults during processing. Check input formatting and consider using sub_data_type = STRING or ORIGIN as needed.
- Got a JSON string instead of structured data: STRING output without index_or_key always returns a JSON-formatted string. Choose LIST or DICT output to get structured results, or set index_or_key to extract a single item as a primitive.