error->calling toobject with incompatible return type qjsonobject
Unsolved
General and Desktop
-
Stuck at this piece of code..now sure why it is throwing the error
calling toobject with incompatible return type qjsonobject
void converter::convertFromToArray(QJsonArray *fromarray,vector<eachvalue*> *toArray){ foreach (const QJsonValue & value, fromarray) { QJsonObject obj=value.toObject(); eachvalue eachvalueObj; eachvalueObj.update=obj.value("startingTime").toInt(); } }
The array looks like this
[ { "startingTime": 11 }, { "startingTime": 12 } ]
What exactly is going wrong?
-
Hi,
You are running your foreach loop on a pointer to a QJsonArray rather that on the array content.