Results 1 to 5 of 5

Thread: QJsonDocument: How to replace a single object / or add it if it doesn't exists?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2015
    Posts
    14
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default QJsonDocument: How to replace a single object / or add it if it doesn't exists?

    Hi there,

    lets say there is a JSON file with more than 100 objects, build with QJsonObject, QJsonDocument and QFile:

    {
    "object1": {
    "name": "whatever",
    "size": "1"
    },
    "object6": {
    "name": "whatever",
    "size": "1"
    }
    "object23": {
    "name": "whatever",
    "size": "1"
    }
    and so forth...
    }

    With Qt 5.6 what's the easiest way to replace a single object (for example "object6") / or insert one if it doesn't exist (for example "object4")?

    I got no problem to write the hole JSON file with a replaced or inserted new object again. But is it possible to just write / replace a single object?
    Last edited by mireiner; 31st March 2016 at 17:40.

Similar Threads

  1. Replies: 1
    Last Post: 25th December 2015, 12:47
  2. QJsonDocument toJson(QJsonDocument::Compact) not working
    By elmar.wieser in forum Qt Programming
    Replies: 2
    Last Post: 9th January 2015, 06:23
  3. QSignalMapper One single Object
    By cafu1007 in forum Qt Programming
    Replies: 7
    Last Post: 18th April 2011, 08:46
  4. Replies: 2
    Last Post: 21st February 2011, 14:52
  5. Replies: 2
    Last Post: 20th April 2010, 21:27

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.