QJson parsing without quotation marks
-
wrote on 1 Sept 2015, 12:40 last edited by
Example QByteArray (ba) looks like:
{
"testA": "1234",
"testB": 5678,
}Parsing code:
QJsonDocument jsonResponse = QJsonDocument::fromJson(ba);
QJsonObject tokenObj = jsonResponse.object();
testA= tokenObj["testA"].toString();
testB = tokenObj["testB"].toString();testA properly returns "1234" while testB returns ""
Any ideas are welcome, thanks in advance!
-
wrote on 1 Sept 2015, 12:44 last edited by
Hi,
testB = tokenObj["testB"].toInt();
will work as you provided a number 5678.
1/2