×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: C++
Posted by: Teun Grinwis
Added: Apr 16, 2015 2:17 PM
Views: 126
Tags: c++ qt
  1.     qCDebug(DBG) << ">>>>>>>>>>>>>>>>>>>>>>>>>> json write >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
  2.    
  3.     QJsonObject json;           // json object(s)
  4.  
  5.     json["mac"] = mac;          // add key, value pair to json
  6.  
  7.     QJsonArray alwTpArr0_3;
  8.     alwTpArr0_3.append(fixed.allowedTypes[0][ix]);
  9.     json["allowdTypes0_3"] = alwTpArr0_3;       // add array
  10.  
  11.     qCDebug(DBG) << "json string=" << jsDoc.toJson();   // json to byte array
  12.  
  13.     qCDebug(DBG) << ">>>>>>>>>>>>>>>>>>>>>>>>>> json read >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
  14.  
  15.     QJsonParseError err;
  16.     QJsonDocument jsdocFmStr = QJsonDocument::fromJson( strJson.toUtf8(), &err ); // json obj from QString
  17.  
  18.     mac = rdjson.value(QString("mac")).toString();      // read key, value
  19.  
  20.  
  21.