Looking at the documentation for QJsonDocument you can read the file into a QByteArray and then do the following: -
// assuming a QByteArray contains the json file data
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson(byteArray, &err);
// test for error...
Then use the function on the QJsonDocument to retrieve the top level object...
if(doc.isObject())
{
QJsonObject obj = doc.object();
QJsonObject::iterator itr = obj.find("id");
if(itr == obj.end())
{
// object not found.
}
// do something with the found object...
}
There is also a value() function in QJsonObject, so instead of using the iterator and calling find, you may simply be able to call: -
QJsonValue val = obj.value("id");
Disclaimer: I present this code after having just read the Qt documentation, so do not just copy and paste this, but consider it more as pseudo code. You may need to edit it a little, but hope that helps.