Keep 'null' attributes

This commit is contained in:
Stephan Hadinger 2020-08-23 14:57:19 +02:00
parent d7017661ed
commit 7a3fad5a92
1 changed files with 2 additions and 2 deletions

View File

@ -818,8 +818,8 @@ void CopyJsonVariant(JsonObject &to, const String &key, const JsonVariant &val)
to.remove(key); // force remove to have metadata like LinkQuality at the end to.remove(key); // force remove to have metadata like LinkQuality at the end
if (val.is<char*>()) { if (val.is<char*>()) {
String sval = val.as<String>(); // force a copy of the String value, avoiding crash const char * sval = val.as<char*>(); // using char* forces a copy, and also captures 'null' values
to.set(key, sval); to.set(key, (char*) sval);
} else if (val.is<JsonArray>()) { } else if (val.is<JsonArray>()) {
JsonArray &nested_arr = to.createNestedArray(key); JsonArray &nested_arr = to.createNestedArray(key);
CopyJsonArray(nested_arr, val.as<JsonArray>()); // deep copy CopyJsonArray(nested_arr, val.as<JsonArray>()); // deep copy