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

QJsonDocument::toJson() uses hardcoded indent settings for Indented format

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.7.1
    • Core: Other
    • None

    Description

      While QJsonDocument::Indented indeed produces human readable output it might also inflate resulting file size due to hardcoded usage of four tabs.
      This can lead to more than doubling file size comparing to indenting with single tab (for example when storing short key and value pairs in hierarchy of multiple objects or arrays).

      There already exists equivalent API in QXmlStreamWriter:

      QXmlStreamWriter::setAutoFormattingIndent(int spacesOrTabs)
      This property holds the number of spaces or tabs used for indentation when auto-formatting is enabled. Positive numbers indicate spaces, negative numbers tabs.
      The default indentation is 4.

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            emdek MichaƂ Dutkiewicz
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes