Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.0
-
None
-
All Platforms. Qt 5.15
Description
I'm not sure this is a bug or intended in Qt 5.15. But this has caused problem with my code unless I apply fix in my code.
In Qt 5.14.2, the following code:
QVariantMap map; map["Test"] = "Good"; QVariantMap map2; map2["json"] = QJsonDocument::fromVariant(map).toJson(QJsonDocument::Compact); qDebug() << QJsonDocument::fromVariant(map).toJson(QJsonDocument::Compact); qDebug() << QJsonDocument::fromVariant(map2).toJson(QJsonDocument::Compact);
Will print out this:
"\{\"Test\":\"Good\"}" "{\"json\":\"{\\\"Test\\\":\\\"Good\\\"}\"}"
But in Qt 5.15, it will print out this:
"\{\"Test\":\"Good\"}" "\{\"json\":\"eyJUZXN0IjoiR29vZCJ9\"}"
The fix for me is pretty simple:
map2["json"] = QString(QJsonDocument::fromVariant(map).toJson(QJsonDocument::Compact));
But still, would be nice if it works the way it worked before without having to fix the code. I want to confirm that this is not a bug but intended.
Thanks!
Attachments
Issue Links
- duplicates
-
QTBUG-84739 Regression with dataloss
-
- Closed
-