Data Type Converter

A simple block to change the data type of an incoming value so downstream blocks receive the expected format. Use this when you need to ensure a value is treated as a number, text, list, dictionary, batch, or boolean for further processing or export.

πŸ“₯ Inputs

Generic β€” Any kind of data input (text, number, list, batch, etc.). Provide the value you want converted.

πŸ“€ Outputs

Generic β€” The converted value in the selected target type. Use this output to feed other blocks that expect a specific data type.

πŸ•ΉοΈ Controls

Convert to β€” Dropdown where you pick the target type. Available choices include Integer, Boolean, String, Float, Batch, List, and Dictionary.

🎨 Features

  • Convert single scalar values between common types (number, text, boolean).

  • Create list or batch wrappers when a collection is required by downstream blocks.

  • Parse JSON-like text into a dictionary when Dictionary is selected and the input is a valid JSON string.

  • Defensive behavior: when input is missing or incompatible, the block provides a safe default output and indicates an issue.

πŸ“ Usage Instructions

  1. Connect the data source to the Generic input.

  2. Choose the desired target type using the Convert to dropdown.

  3. Use the block's Generic output as the input for downstream blocks that require the chosen type.

Common scenarios:

  • Convert user-entered text to a number before applying math blocks.

  • Convert a JSON string to a dictionary before exporting or parsing fields.

  • Wrap a single item into a List or Batch so list-aware blocks can process it.

πŸ“Š Evaluation

When the block runs, it reads the current input and outputs it in the selected format. If conversion is not possible, it outputs a safe default and logs the condition for attention.

πŸ’‘ Tips and Tricks

  • Use Debug Input to inspect raw values before conversion so you can pick the correct target type.

  • If you expect missing values, place Is None before this block to detect them and Replace None to insert a fallback value.

  • When preparing structured payloads for logging or APIs, combine String Merge or Data to JSON with this block to produce properly formatted data.

  • For batch workflows, pair this block with Batch Concatenation, Get Batch Size, or Debatch to inspect or flatten batch contents after conversion.

  • After converting to dictionary form, persist or share results using Data Write Local, Data Write Global, or export via CSV Export.

(hint: use String Input or Number Input blocks as simple sources when testing conversions)

πŸ› οΈ Troubleshooting

  • If conversion fails or output seems unchanged, check the input value with Debug Input to confirm its current type and content.

  • If Dictionary conversion doesn't work, verify the input is valid JSON text (proper quotes, commas, braces).

  • When working with batches or lists, confirm the selected target (List vs Batch) matches what downstream blocks expect; use Get Batch Size to verify batch contents.

  • For unexpected boolean conversions, ensure the input string or number follows a clear true/false convention (for example, 0/1 or true/false).

Last updated

Was this helpful?