FCM字段“数据"必须是JSON数组 [英] FCM Field "data" must be a JSON array
问题描述
您好,我与邮递员一起制作了我的json对象FCM消息: 但是当我尝试发送时:
Hi im working with postman to make my json object FCM message: But when i try to send:
{
"to":"fzvihT7dFUI:APA91bFVhnWAxXVjlWiiHIs9ZUyL1DE2hZO6GpItJtReh3hcKF1kD6mLuQq9fNP9xvS5bOFWUOG-OW-uyOedc1C43m8jfvD4OOfsBYuMbM7t1-dZEy2kQcuv3gJw6dhneVus2AR_hQHQ",
"data":[
{
"time":1501385514224,
"CC":"1030626890"
}
],
"notification":{
"body":"SPO2:95 \nPulso:75",
"title":"El paciente Daniel Ortiz nesecita asistencia"
}
}
响应如下:
字段数据"必须是JSON数组: [{"CC":"1030626890",时间":1501385514224}]
Field "data" must be a JSON array: [{"CC":"1030626890","time":1501385514224}]
但是我知道[{"CC":"1030626890","time":1501385514224}]
它是一个数组,我不理解问题.
我做错了什么?
But i know the [{"CC":"1030626890","time":1501385514224}]
its a array, i dont understand the problem.
What i made wrong?
推荐答案
From the Firebase Cloud Messaging documentation, it seems like data
should be a JSON object:
{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"data" : {
"Nick" : "Mario",
"body" : "great match!",
"Room" : "PortugalVSDenmark"
},
}
我不确定为什么错误消息说它必须是一个数组.就像是 关联数组" JSON对象的另一个术语.
I'm not sure why the error message talks says it needs to be an array. It's like meant as an "associative array" which is really just another term for a JSON object.
这篇关于FCM字段“数据"必须是JSON数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!