ArduinoJson 5: How did you manage to load from file in to global root object?
I am referring to your example and comment:
“As we will reload the current history, we already have the root buffer. No need to create a new one.”
You have created the ‘root’ object in Global declaration:
JsonObject& root = jsonBuffer.createObject();
And created an array:
JsonArray& timestamp = root.createNestedArray(“timestamp”);
When you call load history, you read the data in to an object called ‘root’ expecting that the global root object will get updated.
JsonObject& root = jsonBuffer.parseObject(buf.get());
Does it really work? I mean isn’t is that when you exit function loadHistory() this reference gets destroyed?
I tried to follow your example to reload the history in to the same object declared in global context but the data do not appear in the global object.
Can you clarify whether the example is really working? I used 5.13.5 Library with your example code.