How to prevent string escaping?
String escaping is the feature that allows to have special characters in your encoded string.
For example:
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["hello"] = "[1,2,3]";
root.printTo(Serial);
would print:
{"hello":"[1,2,3]"}
If you want to disable string escaping, you need to wrap the char*
with RawJson()
, like this:
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["hello"] = RawJson("[1,2,3]");
root.printTo(Serial);
which would print:
{"hello":[1,2,3]}