![]() I hope this speeds up someone else's progression on this topic. These fields are then output in a nested JSON format which looks like this. ![]() which you just ignore) and extracts some fields. It takes an internal QT Structure (a List of pointers to a CabrilloRecord object. JsonObject.insert("number", jsonArray.size()) JsonObject.insert("Sender",jsonSenderLatObject) JsonObject.insert("Receiver",jsonReceiverLatObject) JsonReceiverLatObject.insert("Receiver",rec->getReceiver_call()) JsonReceiverLatObject.insert("Lon",rec->getReceiver()->fLon) JsonReceiverLatObject.insert("Lat",rec->getReceiver()->fLat) JsonSenderLatObject.insert("Sender",rec->getSender_call()) JsonSenderLatObject.insert("Lon",rec->getSender()->fLon) JsonSenderLatObject.insert("Lat",rec->getSender()->fLat) JsonObject.insert("Band", rec->getBand().toStr()) ![]() QFile file(QDir::homePath() + "/1.json") This is the QT C++ Code void CabrilloReader::JsonOutputMapper() This is an example of how to create a JSON output with some structure.įorgive me for not explaining what the fields all mean - it is a Ham Radio processing output script. JSON under QT is actually quite pleasant - I was surprised. "QJsonObject of value: " QJsonValue(array, QJsonArray() ) "QJsonObject of description: " QJsonValue(string, "Home") QWarning() << tr("QJsonObject of value: ") << item * in case of array get array and convert into string*/ * in case of string value get value and convert into string*/ QWarning() << tr("QJsonObject of description: ") << item QJsonValue value = sett2.value(QString("appName")) ![]() QJsonDocument d = QJsonDocument::fromJson(val.toUtf8()) Example: Read json from file /* test.json */įile.open(QIODevice::ReadOnly | QIODevice::Text) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |