How to verify multiple values in array

This is my response I need verify values

{
    "status": "success",
    "data": {
        "actions": [
            {
                "result": "https://"example/312922896055201.jpg",
                "original_image": "example/312922896055201.jpg",
                "type": "image",
                "destination_size": {
                    "h": 2504,
                    "w": 2000
                },
                "resource": {
                    "license": "fte",
                    "resource_url": "example/312922896055201.jpg",
                    "resource_id": "312922896055201",
                    "source_type": "company",
                    "type": "photo"
                }
            },

For result in actions array I wrote this code

let jsonDataResult = pm.response.json();
pm.test("Result is correct", function () {
    var jsonDataResult = pm.response.json();
    pm.expect(jsonDataResult.data.actions[0].result).to.eql("example/312922896055201.jpg");
});

But for type in actions array the same is not working

let jsonDataType = pm.response.json();
pm.test("Type is correct", function () {
    var jsonDataType = pm.response.json();
    pm.expect(jsonDataType.data.actions[1].type).to.eql("image");
});

What to do?
Thanks in advance.

Your array does not seem to have two elements.

So try

jsonDataType.data.actions[0].type

2 Likes