The json int data type automatically change to double

Viewed 42

When i set int json data to message, it automatically change to double type locally.

// The json send to HMS server.
{
    "validate_only": false,
    "message": {
        "data": "{'int_type':0}",
    ...
}

// The data received locally.
{ int_type=0.0 }
1 Answers

Method 1: change all int type to string.

Method 2: pass the string in json, convert it to int locally.

    "message": {
        "data": "{'int_type':'0'}",

int_type.toInt()
Related