Hi @SGaist , no sorry. This was my first try to solve this. It dosn't work because of:
@JNBarchan said:
Once JSON has taken it as a double, it's too late.
With a small test program I testes Qt-JSON: https://github.com/qt-json/qt-json
#include <QCoreApplication>
#include <QDebug>
#include "json.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString json = "{\"success\":true,\"message\":\"some-message\",\"number1\":1.234,\"number2\":\"5.678\"}";
bool ok;
QtJson::JsonObject result = QtJson::parse(json, ok).toMap();
qDebug() << "number1: " << result["number1"].toString();
qDebug() << "number2: " << result["number2"].toString();
return a.exec();
}
Which gives me the following output:
number1: "1.234"
number2: "5.678"
So I think I can work with this library, but a bit sad about the truth, that such a case can't be handled without external libraries.