Converting between data types
When passing data from one step to another, sometimes you will need to convert the data type of certain values.
Commonly this is when a destination service has certain type requirements (strings v numbers, objects v arrays, booleans etc.) which the source of your data does not meet.
Strings / NumbersCopy
If a number has been returned as a string you may need to convert it to a number in order to satisfy the requirements of your destination service. Or vis versa.
In this case we can use the Text Helpers Change type operation:
ArraysCopy
If we have a case of a simple list of values that need to be converted to an array:
1{2"value": "123, 111, 444"3}
We can use the Text Helpers 'split' operation, set to 'split by' a comma:
Note however that each item in the array is a string.
We could also use the Object helpers 'JSON parse' operation to create an entirely new JSON object and use square brackets to return an array.
This will return an array of numbers:
BooleansCopy
If you need to convert a String "true"
or "false"
into an actual boolean, once again you can use the Text Helpers 'Typecast' connector.
If you are using the Boolean Connector to compare, you can actually perform the type conversion within the connector itself - just ensure that the 1st and 2nd values are set to the same data type: