When making an AJAX call from my application to send a JSON message, I include the following variable:
json_msg = {"object":"page",
"entry":[
{"id":"317614815243036",
"time":1473615625653,
"messaging":[
{"sender":{id":"1142389195826076"},
"recipient":{"id":"317614815243036"},
"timestamp":1473615625498,
"message":{
"mid":"mid.1473615625491:99adedcab35dd94768",
"seq":4741,
"text":"Hey"
}
}]
}
]
}
However, when I check console.log(json_msg)
, I notice that there are additional "0" keys added like this:
json_msg = {"object":"page",
"entry":[
0:{"id":"317614815243036", // A ZERO ADDED HERE
"time":1473615625653,
"messaging":[
0: {"sender":{id":"1142389195826076"}, // A ZERO ADDED HERE
"recipient":{"id":"317614815243036"},
"timestamp":1473615625498,
"message":{
"mid":"mid.1473615625491:99adedcab35dd94768",
"seq":4741,
"text":"Hey"
}
}]
}
]
}
After investigating by commenting out the call and just logging the variable, it seems like these extra "0" keys appear right after assigning the variable.
I am struggling to pinpoint the root of this seemingly simple mistake.