How to convert a QJsonObject to a QString
I have a QJsonObject data and want to convert to QString. How can I do this? Searched for help in Qt, it only can convert QJsonObject to QVariantMap...
Thanks in advance.
You need to get a QJsonValue, which has a .toString() method. That or you need to use QJsonDocument to turn a whole object into a string.
@QString jsonToString(QJsonObject json)
QJsonDocument Doc(json); QByteArray ba = Doc.toJson(); return QString(ba);
Indeed. Go through QJsonDocument.
Thank you, I will try that.