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

Error parsing or generating json

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.7.1, 5.15.12
    • Other
    • None
    • Windows

    Description

      QJsonObject,QJsonDocument,The following is an error code demonstration:

      QJsonObject jo;

      jo["id"]=431536871475019777;

      qDebug()<<jo<<jo.value("id").toVariant().toLongLong(); //This will output:QJsonObject({"id":431536871475019800}) 431536871475019776,The value is different

      //-------------------------------------------

      Looking at the QJsonValue code, I found that it was converted to a double type, so there was a precision problem

      QJsonValue::QJsonValue(qint64 n) : d(0), t(Double)

      {

      this->dbl = double;

      }

       

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            afeng huang weifeng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes