1、QJsonObject转QString
QString strRet;
QJsonDocument doc(jsonObj);
strRet = QString(doc.toJson(QJsonDocument::Indented));
2、QString转QJsonObject
QJsonDocument doc = QJsonDocument::fromJson(strJson.toUtf8());
QJsonObject obj = doc.object();
3、QJsonArray转QString
QString strRet;
QJsonDocument doc(jar);
strRet = QString(doc.toJson(QJsonDocument::Indented));
4、QString转QJsonArray
QJsonDocument doc = QJsonDocument::fromJson(strJson.toUtf8());
QJsonArray arry = doc.array();
QJsonDocument::Indented:格式化显示
QJsonDocument::Compact:非格式化显示