After creating test scripts with the following response data,
{ "page": 2,
"per_page": 6,
"total": 12,
"total_pages": 2,
"data": [
{"id": 7,
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fb969298939a9e97d5979a8c">[email protected]</a>",
"first_name": "Michael",
"last_name": "Law}]}
I successfully used pm.jsondata.data[1].id to access the data in the above response. However, when trying to apply it to the following response:
[
{
"userId": 6275,
"userName": "samual",
"accountId": 54751,
},
{
"userId": 8126,
"userName": "Martine",
"accountId": 54751,
}]
I attempted to use jsondata=pm.response.json; jsondata[1].userId, but encountered an error stating TypeError: Cannot read property '1' of undefined.