qt 解析json文件



 QJsonDocument mDocument;
mDocument = QJsonDocument::fromJson(json);
 
  
    if (!mDocument.isNull())
    {
        if (mDocument.isArray()) {
            QJsonValue(mDocument.array());
        } else {
            QJsonValue(mDocument.object());
        }
        return true;
    }
 
  
 
  
 
  
if ( value.isObject())
    {
 
  
        //Get all QJsonValue childs
        foreach (QString key , value.toObject().keys()){
            QJsonValue v = value.toObject().value(key);
            
 
  
        }
 
  
    }
 
  
    else if ( value.isArray())
    {
        //Get all QJsonValue childs
        int index = 0;
        foreach (QJsonValue v , value.toArray()){
 
  
            
        }
    }


你可能感兴趣的:(QT)