I have made class that convert QList<qreal>
(very big list) to JSON string, but it generates a extra large text.
Here is code:
QJsonObject rootObject;
rootObject.insert("Test",0.05);
qDebug()<<QJsonDocument(rootObject).toJson(QJsonDocument::Compact);
And I have tried equal code:
QJsonObject rootObject;
rootObject.insert("Test",QString("0.05").toDouble());
qDebug()<<QJsonDocument(rootObject).toJson(QJsonDocument::Compact);
And debug ouptut is always:
{"Test":0.050000000000000003}
I want to get short output like this:
{"Test":0.05}
Is there way to fix QJsonDocument
? Or make some decimals count rounding/limit?