In in old versions of ArduinoJson, MemberProxy (the class returned by operator[]) could lead to dangling pointers when used with a temporary string. To prevent this issue, MemberProxy and ElementProxy are now non-copyable, starting from ArduinoJson 7.3.

Your code is likely to be affected if you use auto to store the result of operator[]. For example, the following line won’t compile anymore:

auto value = doc["key"];

To fix the issue, you must append either .as<T>() or .to<T>(), depending on the situation. For example, if you are extracting values from a JSON document, you should update like this:

- auto config = doc["config"];
+ auto config = doc["config"].as<JsonObject>();
const char* name = config["name"];

However, if you are building a JSON document, you should update like this:

- auto config = doc["config"];
+ auto config = doc["config"].to<JsonObject>();
config["name"] = "ArduinoJson";

Notice that in the first case, we use as<JsonObject>() because we want to read the value as an object, whereas in the second case, we use to<JsonObject>() because we want to convert the value to an object.

Global warming stripes by Professor Ed Hawkins (University of Reading)