#include<QJsonDocument>
#include<QJsonArray>
#include<QJsonObject>
#include<QJsonParseError>
QJsonParseError jsonError;
QJsonDocument doucment = QJsonDocument::fromJson(text.toUtf8(), &jsonError); // 转化为 JSON 文档
if ( doucment.isNull() || !doucment.isObject() || (jsonError.error != QJsonParseError::NoError))
{
}
QString ls_name=doucment.object().value("name").toString();//有引号的转字符串 QJsonObject jsonObject=doucment.object().value("Data").toObject();//没有引号的转jsonObject QString ls_data=QString(QJsonDocument(jsonObject).toJson());//QJsonObject转QString
double ldc_zxj=doucment.object().value("zxj").toDouble();//转double
QJsonArray array = doucment.array();//转QJsonArray
int nSize = array.size();
for (int j = 0; j < nSize; ++j)
{
QJsonValue value = array.at(j);
if(!value.isObject())
{
}
ls_bh=value.toObject().value("bh").toString();
}