Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-76382

Simpler way of modifying JSON documents

    XMLWordPrintable

Details

    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);
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes