Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.2
-
None
Description
in this code the qjsonobject works perfectely except when item value is string.
lets suppose that we hae an external file called test.json.
test.json:
{
"foo":
}
QString val;
QFile file;
file.setFileName("test.json");
file.open(QIODevice::ReadOnly | QIODevice::Text);
val = file.readAll();
file.close();
QJsonDocument d = QJsonDocument::fromJson(val.toUtf8());
QJsonObject sett2 = d.object();
QJsonValue functions = sett2.value(QString("foo"));
QJsonObject item = functions.toObject();
QJsonValue item1 = item["item1"];
QJsonValue item2 = item["item2"];
QJsonValue item3 = item["item3"];
QJsonArray item4 = item["irwm4"].toArray();
///// output:
item1 = integer = 4999
item2 = not accessible
item3 = bool = true
item4 = array = [....]