IoT Platform supports the following data types. When you define Thing Specification Language (TSL) features for a product, you can use these data types.

Data type Description Example
int32 32-bit integer. 10
float Single-precision floating-point. 1.1
double Double-precision floating point. 1.23
text String. The data cannot exceed 10,240 bytes in length. "Hello world!"
date Timestamp. A UTC timestamp in the string format. Unit: milliseconds. "1635839462000"
bool Boolean. Boolean values include 0 (false) or 1 (true). The data type of 0 and 1 are int32. 0: off. 1: on.
enum Enumeration. When you define a value and description for an enumeration item, make sure that the value is an integer. The integer 0 indicates red, the integer 1 indicates blue, and the integer 2 indicates green.
struct JSON object. When you define a JSON structure, elements in the structure support the int32, float, double, text, date, bool, and enum data types. Nesting of structures is not supported.
{
  "name":"Tom",
  "age":10
}
array Array. You must specify the data type and number of elements in an array. Elements support the int32, float, double, text, or struct data types. Make sure that the elements in the array are of the same type. The number of elements must be 1 to 512. [1, 2, 3, 4, 5, 6]

References