How can I JSON serialize a QVariant (or other type of data) in Qt. I don't want to use an external third party library like QJson
Just to mention, as of Qt5, JSON is officially supported:
JSON Support in Qt
QVariant id(1), name("John Doe");
QJsonObject json;
json["Name"] = name.toString();
json.insert("id", id.toInt());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With