Issue with JSONDecode

Hi.

Pretty straightforward question, I’m using JSONDecode to find the groups of a user and their role in the groups.

The JSON string returns in this format:

  "data": [
    {
      "group": {
        "id": 0,
        "name": "string",
        "memberCount": 0,
        "hasVerifiedBadge": true
      },
      "role": {
        "id": 0,
        "name": "string",
        "rank": 0
      },
       "group": {
        "id": 0,
        "name": "string",
        "memberCount": 0,
        "hasVerifiedBadge": true
      },
      "role": {
        "id": 0,
        "name": "string",
        "rank": 0
      },
    }
  ]
}

I’m just wondering how I would iterate through multiple groups & their respective role in that group.

I’m currently using:

local groups = getgroups("LucyySquad") -- function to return the groups of the player
print(groups["data"]["group"]["id"])-- "groups" is the returned (and decoded) string

Expected output:
"0"

Output:
" "

How do I fix this? Am I doing something wrong, and how would I iterate through multiple groups?

Depends. May I see more of the code?

And if there is, what error does it show in the output?

Sorry, solved! Thank’s for the attempted assistance though.