QVariantList with other QVariantLists inside?

Hello

I'm parsing a response a QNetworkReply JSON and turn it into a QVariantList as follows:

const QByteArray response(reply->readAll());

JsonDataAccess jda;
QVariant results = jda.loadFromBuffer(response).toMap();
m_theList = results.toMap().find("body")->toList();

Inside the list, there are also OTHER lists that I need to access the elements of in QML. I am able to access the items at a higher level such as name and description:

{
    "body": [
        {
            "id": "99d745e8-66b7-42e7-9de8-bd9edab7d085",
            "name": "Test Item",
            "description": "Test Description",
            "permissions": [
                {
                    "type": "Admin",
                    "status": "Pending"
                }
            ]
        }
    ]
}

However, when I try to access the field 'type' of the list of additional permissions, I don't get the result.

        listItemComponents: [
            ListItemComponent {
                type: "listItem"
                StandardListItem {
                    title: ListItemData["name"]
                    description: ListItemData.permissions["type"]
                }
            }
        ]

Am I going about this wrong? Thank you!

Figured it out. I wasn't giving him a clue to look inside the other QVariantList. What fixed it:

description: ListItemData.permissions[0].type

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for