I am trying to parse a JSON response from Postman that is not cooperating. Here is the body response:
{
"teams": [
{
"id": "MI6",
"name": "James Bond's Workspace",
"color": "#04a9f4",
"avatar": null,
"members": [
{
"user": {
"id": 007,
"username": "James Bond",
"email": "[email protected]",
"color": "#e65100",
"profilePicture": null,
"initials": "JB",
"role": 1,
"custom_role": null,
"last_active": "1609978205632",
"date_joined": "1609897014429",
"date_invited": "1609897014429"
}
}
]
}
]
}
I am using the following test scripts that can't seem to resolve the [ value after teams.
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("teams_id", jsonData.teams.id);
postman.setEnvironmentVariable("teams_id", jsonData.teams.user.id);
It is creating the variable for me, but will not store the value of MI6 or the value of 007.