[Development] QJsonDocument toJson()

Michal Dorner dorner.michal at gmail.com
Fri Nov 30 01:40:03 CET 2012


Hi,

I just tried to switch from qjson external library to qt5 QJsonDocument and
found this:

QJsonDocument doc = QJsonDocument::fromJson("{\"user_id\":1000000}");
qDebug() << doc.toJson();

output:

"{

    "user_id": 1e+06

}

"


Any number >= 1000000 is serialized in exponential format with precision
lost. Is that harcoded limit?

In javascirpt numbers are 64-bit floating point values, the largest exact
integral value is 2^53, or 9007199254740992.

And where is option to output in compact form (without additional
whitespaces) ?

I'm using Qt 5.0 beta2 on linux. Thanks.


Best Regards

  Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121130/ee6d7517/attachment.html>


More information about the Development mailing list