Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
Description
To modify a value inside a tree of nested objects, one has to store a copy of each object up until that tree, change the value and re-insert the objects in backward order. Deeper the value to be changed is, more complicated it becomes.
For example, with only 1 level it is already:
QJsonDocument doc = ...; auto root = doc.object(); auto object1 = root.value("object1").toObject(); object1.insert("value", "some value"); root.insert("object1", object1); doc.setObject(root);