Hi,

I’m doing a request to an url which gives me the next Json reply:

Qt Code:
  1. "{"data":"[{\"Name\":\"One\",\"Code\":\"\"},{\"Name\":\"Two\",\"Code\":\"Alpha\"}]"}"
To copy to clipboard, switch view to plain text mode 
I am using Qt 8.4.5 so I have to do it with QNetwork and QScript. So following an example I saw (Example)I did the next:
Qt Code:
  1. QNetworkRequest request(_Url);
  2. QNetworkReply *reply = nam->get(request);
  3.  
  4. QString InfoByteArray = (QString)reply->readAll();
  5.  
  6. if ( reply->error()== QNetworkReply::NoError)
  7. {
  8. //------------ JSON Parser --------------//
  9.  
  10. QScriptEngine engine;
  11. QScriptValue result = engine.evaluate("("+InfoByteArray+")");
  12.  
  13. QScriptValue InfoData= result.property("data");
  14. qDebug() << "InfoData" << InfoData.toString();
  15. }
To copy to clipboard, switch view to plain text mode 

With that I get all the part on the right of “data”:

Qt Code:
  1. [{"Name":"One","Code":""},{"Name":"Two","Code":"Alpha"}]"
To copy to clipboard, switch view to plain text mode 
Now I want to take the Name en Code values ofc but I can’t get them, I try doing this but never goes into the while:

Qt Code:
  1. QScriptValueIterator it(InfoData);
  2. while (it.hasNext())
  3. {
  4. it.next();
  5. QScriptValue entry = it.value();
  6.  
  7. QString name= entry.property("Name").toString(); //this doesnt works
  8. QString name2= entry.property("data").property("Name").toString(); //this either
  9. }
To copy to clipboard, switch view to plain text mode 
And if I try doing that out of the while, I just get empty strings :
Qt Code:
  1. QString name= result.property("Name").toString(); // qDebug() << name; returns ""
  2. QString name2= entry.property("data").property("Name").toString();
To copy to clipboard, switch view to plain text mode 
So…Any Idea of what am I doing wrong here so I can't get the Name or the Code values??

Thank you!