I am working on a webhook with multiple variables in a JSON format. When I create the variable and use Particle.publish, I get this output:
Particle.publish("Name", name);
Particle.publish("RSSI", curRSSI);
“Name” = “iBeacon”
“RSSI” = “-67”
However, when I try using the JSON format with the same variables, I get this output:
String data = String::format("{ \"DeviceName\": \"%u\", \"RSSI\": %u }", name.c_str(), curRSSI.c_str());
Particle.publish("tracking_event", data);
“tracking_event” = {
“DeviceName”: “537036472”
“RSSI”: 536974024
}
Why are these variables (name and curRSSI) changing?