How to prevent string escaping?
This page covers ArduinoJson 5.13.5, consider upgrading to version 6.21.2.
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]}