Particle.publish and JSON escaped data


I am sending an event with a payload with JSON data. I am forming the data with escaped “” quotes.

This is how I publish:
String msg = String::format("{“RPP”:%li, “SOLNRG”:%f, “VTS”:%f, “SOC”:%f, “LOWP”:%d, “DSLP”:%li}", reportPeriod,solarNrg,voltage, soc,alert,wasInDeepSleep);

So the Quotes are escaped to form the payload string…

In the event it appears like this:
{“data”:"{“RHUM”:48.946899, “TMP”:1610612736, “BARO”:29.840662, “WDIR”:0, “WSPD”:0}",“ttl”:“60”,“published_at”:“2015-10-27T06:43:01.303Z”,“coreid”:“30003b000447343138333038”,“name”:“WXATMOS”}

So the slahes are there!
How can I remove those?
I am unable to retrieve the data from the keys… Since the keys contain the \ :smile:

Any clues?

@frlobo how do you retrieve the data object? My events have the \ in there as well:

{"name":"sensor","data":"{\"status\": 0, \"temp\": 19.61, \"pressure\": 1011.15, \"humidity\": 59.32, \"soil1\": 3235, \"soil2\": 3303, \"soil3\": 3298}","ttl":"60","published_at":"2015-10-26T15:06:36.722Z","coreid":"25002c000447343339373536"}

I'm processing them via a web hook:

and reading them in the browser similar to the approach described here:

I have no trouble with the "".

1 Like

@mhdevx - we discussed this problem before here:
Posting non-string data to using Webhook

I have exactly the same issue - cannot post numbers, can only post strings using webhooks. Easiest way is to have a proxy hop in-between PHP / Node that converts strings to numbers before posting to

This is a known limitation in the way Particle web hooks are implemented. @Dave commented on this in an different discussion.