Details
-
Bug
-
Resolution: Duplicate
-
P1: Critical
-
None
-
5.15.0
-
None
-
All.
Description
There are at least 2 major issues with JSON support in Qt 5.15.0:
1 - JSON objects that have a key that maps to a "null" value get omitted from the serialized JSON. E.g.:
QVariantMap{"key1","somevalue,"key2", QVariant{ }}
Serializes to the following JSON on Qt 5.14 and below:
{{
{"key1":"somevalue","key2":null}}}
On Qt 5.15.0 and above it produces:
{{
{"key1":"somevalue"}}}
Notice how "key2" is omitted. This is a breaking change because sometimes existing application specifically put null values into a json object to indicate something. What's more, if you attempt to implement JSON RPC and you sent a null "result", the resulting produced json is no longer valid JSON-RPC!
2 - QByteArray's that get put into QVariantMaps and QVariantLists end up auto-converted using base64 encode. This is unexpected behavior and a breaking change from previous versions of Qt. This breaks many applications.
I consider these pretty bad regressions. I urge you to fix them. Especially (1) which has no workaround and makes generating some shapes of JSON absolutely impossible.
Attachments
Issue Links
- duplicates
-
QTBUG-84610 QJsonDocument::fromVariant ignored null values
-
- Closed
-