Parse jsonarray?

前端 未结 2 1827
不思量自难忘°
不思量自难忘° 2021-02-04 08:26

I\'ve got an JSON like the following:

{
    \"agentsArray\": [{
        \"ID\": 570,
        \"picture\": \"03803.png\",
        \"name\": \"Bob\"
    }, {
              


        
2条回答
  •  时光说笑
    2021-02-04 09:07

    output is QByteArray type

    QJsonDocument doc(QJsonDocument::fromJson(output));
    
    foreach (const QJsonValue & v, doc.array()){
      Person person;
      person.fromJson(v.toObject());
    }
    

提交回复
热议问题