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

QJsonDocument::toJson() generates extra large text.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P4: Low P4: Low
    • 5.7.0 Alpha
    • 5.3.2
    • Other
    • None
    • Qt 5.3.2, Qt Creator, Mac OS X Yosemite, Open Suse Linux.
    • 573f87d81363a303b7005f999a283db624201db8

      QJsonDocument::toJson() generate extra large text using double values.
      Here is a code:

      QJsonObject rootObject;
      rootObject.insert("Test",0.05);
      qDebug()<<QJsonDocument(rootObject).toJson(QJsonDocument::Compact);

      Debug output is always:

      {"Test":0.050000000000000003}

      I want to get compact output like this:

      {"Test":0.05}

      If I use QJsonArray that contains a lot double values then json output is extreme large.

      Is there way to make it compact? If no, than please fix it.

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

            ulherman Ulf Hermann
            ighor IGHOR
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes