If I do:
auto jsonValue = QJsonValue(0.1);
auto jsonObj = QJsonObject();
jsonObj.insert("Key", jsonValue);
QJsonDocument jsonDoc(jsonObj);
auto json = jsonDoc.toJson();
std::cout << json.toStdString() << std::endl;
I get:
{
"Key": 0.10000000000000001
}
But I would like:
{
"Key": 0.1
}
Is this at least possible with Qt?
I use Qt 5.6.
I works fine for Qt 5.9 and Qt 5.11. Not tested with 5.10 but it should also work hopefully.
PS: I know why 0.1 becomes 0.10000000000000001