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

QJsonDocument::toJson() generates extra large text.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.3.2
    • Fix Version/s: 5.7.0 Alpha
    • Component/s: Other
    • Labels:
      None
    • Environment:
      Qt 5.3.2, Qt Creator, Mac OS X Yosemite, Open Suse Linux.
    • Commits:
      573f87d81363a303b7005f999a283db624201db8

      Description

      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.

        Attachments

          Issue Links

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

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes