Hi All,
Trying to publish and pass data formatted as JSON.
Here is my code:
String b = "def";
String c = "ghi";
dataString = String::format("{\"A\" : \"abc\", \"B\" : \"%s\", \"C\" : \"%s\"}", b, c);
Particle.publish("test",dataString, PRIVATE);
Here’s what I am seeing int he console after it runs:
"data": "{\"A\" : \"abc\", \"B\" : \"\", \"C\" : \" \u0010�\u0001 \u0003 \"}"
NOTE: I tried to use b.c_str() for the arguments at the end, but it won’t compile.
This is pretty close to the example in the docs, so I am not sure what’s up.
If I code the string statically as a string it works fine.
(Cloud compile from VSCODE Particle Workbench)