Results 1 to 9 of 9

Thread: qjsonobject

  1. #1
    Join Date
    Aug 2013
    Posts
    9
    Thanks
    6
    Qt products
    Qt3 Qt5 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11

    Post qjsonobject

    can any one tel how to use qjsonobject in the qt program for access the object in json file ......? ..
    if any one give example program then it would be very helpful???????

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: qjsonobject

    QJson is a 3rd party add on for Qt. That page has examples.

    QJsonDocument is a Qt5 class in the Qt JSON Support

    Which one have you tried to use? Where did you get stuck?

  3. #3
    Join Date
    Aug 2013
    Posts
    9
    Thanks
    6
    Qt products
    Qt3 Qt5 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11

    Unhappy qjson

    can any one tel how to use qjsonobject in the qt program for accessing the object inside the .json file??
    any example program....it wil be helpful

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qjson

    Qt Code:
    1. QFile f("...");
    2. f.open(QIODevice::ReadOnly|QIODevice::Text);
    3. QJsonDocument doc = QJsonDocument::fromJson(f.readAll());
    4. QJsonObject object = doc.object();
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    nabeel (5th September 2013)

  6. #5
    Join Date
    Aug 2013
    Posts
    9
    Thanks
    6
    Qt products
    Qt3 Qt5 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11

    Unhappy json array

    how to use qjsonarray in qt program....how to access the Qjsonvalues in .json files using qjsonarray.....? example program will be most helpful
    .

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: json array

    How does your question differ from this one?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: json array

    Or this one? If do not read the replies why bother asking?

  9. #8
    Join Date
    Aug 2013
    Posts
    9
    Thanks
    6
    Qt products
    Qt3 Qt5 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11

    Default Re: json array

    {
    "schema": {
    "friends": {
    "type": "array",
    "items": {
    "type": "object",
    "title": "Friend",
    "properties": {
    "nick": {
    "type": "string",
    "title": "Nickname",
    "required": true
    },
    "gender": {
    "type": "string",
    "title": "Gender",
    "enum": [ "male", "female", "alien" ]
    },
    "age": {
    "type": "integer",
    "title": "Age"
    }
    }
    }
    }
    },
    "value": {
    "friends": [
    { "nick": "tidoust", "gender": "male", "age": 34 }
    ]
    }
    }



    i want access the values of above .json file using QjsonObject or Qjson array.....how to use the qjsonobject..or qjsonarray for accessing the values.....?

    thank for your patience

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: json array

    Threads merged.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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.