huawei-mobile-services - json int数据类型自动变为double

标签 huawei-mobile-services

当我将 int json 数据设置为 message 时,它​​会在本地自动更改为 double 类型。

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

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

最佳答案

方法一:将所有int类型改为string。

方法二:以json方式传入字符串,本地转为int。

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

int_type.toInt()

关于huawei-mobile-services - json int数据类型自动变为double,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69242118/

相关文章:

android - 以编程方式更改 Android 设置 "Schedule power on and off"

android - Harmony OS 中禁止了哪些谷歌服务(这是我在我的 android 应用程序中使用的列表。)

android - Flutter项目添加华为agconnect后构建失败

ionic-framework - Flurry Analytics 是否支持没有 Playstore/GMS 服务的华为设备上的标志性应用程序?

Android withText 选项不适用于 Huawei MediaPad (T1-A21L) 上的操作栏按钮

ios - 体系结构 x86_64 : xcode 9 Swift 4 的 undefined symbol

安卓工作室 : Trouble connecting Huawei device to Android Studio?

java - Android Studio Bumblebee,HMS Toolkit 不工作,为什么?

android - 华为云数据库创建对象类型()崩溃

android - 如何在屏幕关闭后保持播放状态