Qt 6.11 is out! See what's new in the release
blog
How to put QByteArray into QJsonObject
-
Let's say I have a custom class for which I already implemented:
friend QDataStream &operator<<(QDataStream& out, const CustomClass& c); friend QDataStream &operator>>(QDataStream& in, CustomClass& c);How can I put the QByteArray extracted using QDataSteam into a QJsonObject?
Here, my not successful attempt:CustomClass c{}; QByteArray data; QDataStream in(&data, QIODevice::WriteOnly); in << c; QJsonObject message; message["type"] = QStringLiteral("login"); message["binary"] = data.data();Thanks
-