Data Types
Last updated
Last updated
You'll see data types all over Xano, most notably in value fields, to represent the type of data being used for that value.
Data types in Xano
View all of the available data types and their specific functions
Changing data types
Learn how to modify data types if it becomes necessary
As an example, we can use a Create Variable step.
You will notice that the value of 10 has an integer tag above it. This indicates that we are applying the integer data type to this variable
If we instead type 'Hello' as the value for this variable, it switches automatically to text.
It is important to make sure your data type is set appropriately for the data that you are utilizing for that specific value, or you may run into errors.
Data Type | Function | Example |
---|---|---|
text | A text string | "Hello" |
expression | An expression using inline syntax (read more) | a+b*c |
array | A list of values or objects | [1,2,3] |
object | A single JSON object | {text: hello, text2: goodbye} |
integer | A number | 100 |
decimal | A number with decimals | 3.14 |
bool | True or False | true false |
timestamp | A timestamp in UNIX Epoch format, in milliseconds | 1702563772000 |
null | A null value | null |
You can modify the data type of a value by either applying a manual selection or using a filter to convert the data.
When you click a value box, you will see that a drop-down modal appears, allowing quick access to your variables, environment variables, as well as a list of data types. You can navigate to the list of data types quickly by clicking const in the header of the modal, and select the data type of your choice.
For example, when we type a number in a value box, this will typically default to the integer data type. But, if you want this to remain a text string, we can simply change the data type, as shown below.
We also have a number of filters that can serve the purpose of changing the data type of a value.
Filter Name | Function |
---|---|
to_int | Converts to integer data type |
to_decimal | Converts to decimal data type |
to_text | Converts to text data type |
to_timestamp | Converts to timestamp data type |
to_bool | Converts to boolean data type |
safe_array | Not specifically used to turn a string into an array, but ensures that an array data type is always returned |
format_timestamp | Converts a timestamp data type into a human-readable format as a text string |