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

QJsonDocument::fromJson() not working with very big integers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.12
    • Core: Other
    • None
    • All

    Description

      I have found a bug in QJsonDocument::fromJson()
      Parsing following JSON string will not work!

      {"io219":4051331153808338998,"io220":3906362710332355891,"io221":3546361733327093760}
      

      Example program:

      QJsonObject attributs = QJsonDocument::fromJson("{\"io219\":4051331153808338998,\"io220\":3906362710332355891,\"io221\":3546361733327093760}");
      
      qDebug() << "io219 is" << quint64(attributs.value("io219").toDouble());
      qDebug() << "io220 is" << quint64(attributs.value("io220").toDouble());
      qDebug() << "io221 is" << quint64(attributs.value("io221").toDouble());
      
      

      This code will returns:

      io219 is 4051331153808338944
      io220 is 3906362710332356096
      io221 is 3546361733327093760
      

      Only io221 value is correct!

      I understand the problem, but with actual QJson implementation, there is no way to get the correct value, because attributs.value("io220").toString() will returns an empty string.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            kromignon Fabrice Mousset
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes