Is it possible to use long long as a value at QJsonObject ? I was forced to change my API from JSON to XML because 1 field I got had BigInt values and aparently I can't extract big numbers from QJsonValue.
Here's my peace of code that may show what is going on:
QJsonObject json;
unsigned long long ulongmax = ULONG_LONG_MAX;
QVariant variant = ulongmax;
qDebug() << variant;
qDebug() << ulongmax;
json.insert( "key", QJsonValue::fromVariant( variant ) );
unsigned long long json_value = json.value("key").toVariant().toULongLong();
qDebug() << json_value;
Output:
QVariant(qulonglong, 18446744073709551615)
18446744073709551615
9223372036854775808
Desired output:
QVariant(qulonglong, 18446744073709551615)
18446744073709551615
18446744073709551615
Am I doing anything wrong? Can anyone help me find out how to make it work properly without external libs? Thank you!