title: Editing a QVariantMap from QML
body: <p>I have a QVariantMap created in C++ from a JSON object and I want to update this object from QML. I set it as a context property.</p>
  <pre><code>// main.cpp
  engine.rootContext()-&gt;setContextProperty(&quot;myjson&quot;, myqvariantmap);
  </code></pre>
  <p>In QML I tried updating its properties but it seems to be read-only. The <a href="https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#qvariantlist-and-qvariantmap-to-javascript-array-and-object" rel="nofollow noreferrer">docs</a> support this, saying</p>
  <blockquote>
  <p>Mind that QVariantList and QVariantMap properties of C++ types are stored as values and cannot be changed in place by QML code. You can only replace the whole map or list, but not manipulate its contents.</p>
  </blockquote>
  <p>Is there a workaround or an alternative type I can use in place of QVariatnMap?</p>