Hi,
I am trying to send data using a webhook to a website, but upon receiving the data, I noticed that I am receiving escape characters ("\")
along with the data. According to the documents, I should not be receiving the escape characters.
The output I would like to see is within the data is:
"data": "{"Lat":000.0000, "Long":000.0000}",
But, instead I am getting:
"data": "{\"Lat\":000.0000, \"Long\":000.0000}",
Here is my webhook, firmware and output:
Webhook:
{
"event": "Sensible - Test2",
"url": "-----",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": false,
"json": {
"source_device": "{{{PARTICLE_DEVICE_ID}}}",
"datetime": "{{{PARTICLE_PUBLISHED_AT}}}",
"data": {
"Lat": "{{{latx}}}",
"Long": "{{{longx}}}"
}
}
}
Firmware:
String test_message = String::format (
"{\"Lat\":%f, \"Long\":%f}",
latx, longx
);
bool success = Particle.publish("Sensible - Test2", test_message, PRIVATE);
Output:
{
"name": "Sensible - Test2",
"data": "{\"Lat\":000.0000, \"Long\":000.0000}",
"ttl": 60,
"published_at": "2018-09-20T18:05:08.806Z",
"coreid": "----"
}
How should I go about fixing this problem?
Thanks,
Jeffrey