PDA

View Full Version : qjsonobject



nabeel
2nd September 2013, 10:08
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???????

ChrisW67
2nd September 2013, 10:53
QJson (http://qjson.sourceforge.net/) is a 3rd party add on for Qt. That page has examples.

QJsonDocument is a Qt5 class in the Qt JSON Support (http://qt-project.org/doc/qt-5.0/qtcore/json.html)

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

nabeel
3rd September 2013, 18:39
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

wysota
3rd September 2013, 19:33
QFile f("...");
f.open(QIODevice::ReadOnly|QIODevice::Text);
QJsonDocument doc = QJsonDocument::fromJson(f.readAll());
QJsonObject object = doc.object();

nabeel
4th September 2013, 15:52
how to use qjsonarray in qt program....how to access the Qjsonvalues in .json files using qjsonarray.....? example program will be most helpful
.

wysota
4th September 2013, 19:26
How does your question differ from this one (http://www.qtcentre.org/threads/56046-qjson)?

ChrisW67
5th September 2013, 04:00
Or this one? If do not read the replies why bother asking?

nabeel
5th September 2013, 07:53
{
"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

wysota
5th September 2013, 10:14
Threads merged.