Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85264

JSON support has changed in ways that break existing code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • None
    • 5.15.0
    • None
    • All.
    • 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              cculianu calin culianu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes