代码之家  ›  专栏  ›  技术社区  ›  Kashif Jilani

城市飞艇显示错误的JSON载荷

  •  0
  • Kashif Jilani  · 技术社区  · 6 年前

    我正试着从城市飞艇入口发送测试推送。我得到了设备的通道id,创建了json负载。但是当我尝试发送时,它总是显示错误,对不起,这看起来不像有效的json。下面是我的有效载荷数据,请帮助我。

    {
        "audience": {
            "ios_channel": "938a3a93-1a5f-466c-923b-827ef4b0a75b"
        },
        "notification": {
           "aps": {
                "alert": {
                    "body": "Sample",
                    "title": "Sample"
             }
           }
            "ios": {
                "badge": 3
            }
        },
        "device_types": [
            "ios"
        ]
    } 
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Shehata Gamal    6 年前

    这个有效,你忘了逗号,你可以用 https://jsonlint.com 为了这样的事情

    {
        "audience": {
            "ios_channel": "938a3a93-1a5f-466c-923b-827ef4b0a75b"
        },
        "notification": {
            "aps": {
                "alert": {
                    "body": "Sample",
                    "title": "Sample"
                }
            },
            "ios": {
                "badge": 3
            }
        },
        "device_types": [
        "ios"
        ]
    }