Already fixed. https://codereview.qt-project.org/#change,78163

From: [email protected] 
[mailto:[email protected]] On Behalf 
Of Richard Gerd Kuesters
Sent: 19 February 2014 16:40
To: [email protected]
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.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to