I am trying to parse this JSON from a web service.
[
{
"word": "track",
"score": 4144
},
{
"word": "trail",
"score": 2378
},
{
"word": "domestic dog",
"score": 51
},
{
"word": "dogiron"
}
]
When I log out the response from the API call as a QString as below, it comes out fine but with all quotes escaped, thus not making it a valid JSON:
QString response = (QString) data->readAll();
qDebug() << "Return data: \n" << response;
Examples I have seen so far (e.g. Parse jsonarray?) only parse named arrays which they grab from a QJsonObject
by name. Any hints on how to use QJsonArray
directly or together with QJsonDocument::fromJson()
on the return data?