QJsonArray.toArray() then to QStringList ?
Solved
General and Desktop
-
I have a JSON array in a MariaDB record, I want to convert this to a QStringList, so far:
QJsonObject::iterator itOption = objJSON.find(scszOption); ... QStringList slstOptions = itOption.value().toArray().toVariantList();
How do I convert from QVariantList to an instance of QStringList?
-
@JonB said in QJsonArray.toArray() then to QStringList ?:
QVariant::toStringList()
That doesn't appear to be available in Qt 5.9.2, only toStdList. However...I think I've got it:
QVariantList vlstOptions = itOption.value().toArray().toVariantList(); QStringList slstOptions = vlstOptions.value_type.toStringList();