[Development] QJsonDocument Compact output

Richard Gerd Kuesters richard at humantech.com.br
Wed Feb 19 15:47:24 CET 2014


Wow, so fresh! :)

Thanks a lot!


Best regards,
Richard.


On 02/19/2014 11:42 AM, Knight Andrew wrote:
> Already fixed. https://codereview.qt-project.org/#change,78163
>
> From: development-bounces+andrew.knight=digia.com at qt-project.org [mailto:development-bounces+andrew.knight=digia.com at qt-project.org] On Behalf Of Richard Gerd Kuesters
> Sent: 19 February 2014 16:40
> To: development at qt-project.org
> Subject: [Development] QJsonDocument Compact output
>
> Hello all!
>
> I have a question about QJsonDocument, specially in the "Compact" format.
>
> To illustrate better, first the code and its output:
>
> <code>
> int main()
> {
>      QJsonDocument qjd;
>      QJsonObject qjo;
>      qjo.insert("foo", QJsonValue(QString("bar")));
>      qjo.insert("num", QJsonValue(1));
>
>      qjd.setObject(qjo);
>      qDebug() << "-- Idented Output ---";
>      qDebug() << qjd.toJson(QJsonDocument::Indented);
>      qDebug() << "-- Compact Output ---";
>      qDebug() << qjd.toJson(QJsonDocument::Compact);
>      return 0;
> }
> </code>
>
> <output>
> -- Idented Output ---
> "{
>      "foo": "bar",
>      "num": 1
> }
> "
> -- Compact Output ---
> "{"foo": "bar","num": 1}"
> </output>
>
> The question is: why QJsonDocument::Compact doesn't rip off extra spaces between the colon and value? Like: `"num":1` instead of `"num":_1` ? It doesn't make sense, at least for me (this behavior).
>
>
> Best regards,
> Richard.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140219/4144e6e4/attachment.html>


More information about the Development mailing list