Qt 6.11 is out! See what's new in the release
blog
How to convert a QJsonObject to a QString
General and Desktop
4
Posts
3
Posters
18.4k
Views
1
Watching
-
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);}@
-
Thank you, I will try that.