Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. JSON References
Qt 6.11 is out! See what's new in the release blog

JSON References

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 266 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pylvain
    wrote on last edited by
    #1

    I'm working with JSON in Qt. The following code works fine :

    QJsonObject o;
    QJsonValueRef r = o["value"]; 
    r = 3 ;
    qDebug() << o ; // QJsonObject({"value":3}) 
    

    Let's say I want to reference an object now :

    QJsonObject o;
    o["test"] = QJsonObject();
    QJsonValueRef r = o["test"];
    r["value"] = 3;
    

    That doesn't work because there is no operator[] !
    Is there a way to to modify o given r ?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Pylvain said in JSON References:

      Is there a way to to modify o given r ?

      Not with json refs.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved