I'm using QJson to parse data returned in json format. One of the returned items is a 80 character byte array. The return from QJson is a QVariantMap that appears to be an array of long integers when viewed in the Qt Creator debugger.
Is there a better way to convert the QVariantMap to a Byte array than iterating over the Map, casting each QVariant to a byte and assigning it to the byte array?
QByteArray byteArray[60];
QVariantMap returnedMap;
for (int n=0; n< returnedMap.count(); ++n){
byteArray[n] = (char)returnedMap[n];
}
(Code above is for illustration, I'm not certain what the proper syntax is to cast an integer to a byte. The code above results in 'invalid cast from type 'QVariant' to type 'char')