I have a Json response like this:
{
"data": [
{
"id": "someID",
"participants": {
"data": [
{
"id": "idN1"
},
{
"id": "idN2"
}
]
}
},
{
"id": "someID",
"participants": {
"data": [
{
"id": "idN3"
},
{
"id": "idN4"
}
]
}
}
]
}
I want to get the second id array (the most indented ones) inside "participants".
My code is getting the value of the first id value intead of the ones inside participants. Here's my code:
QJsonDocument jsonResponse = QJsonDocument::fromJson(data.toUtf8());
QJsonObject jsonObject = jsonResponse.object();
QJsonArray jsonArray = jsonObject["data"].toArray();
foreach (const QJsonValue & value, jsonArray) {
QJsonObject obj = value.toObject();
if (obj["id"].toString()!=selfID) {
myIdList.append(obj["id"].toString());
}
}
I want to know how could I get rid of the ids less indented and get the most indented ones into myIdList.
Have a nice code!