Defining empty array in collection variables using UI not pm.collectionVariables.set function

Hi all,

I want to declare an empty array from UI as collection variable when I set the initial and current value to [ ]. then in the pre-script I push an object as array element it says push is not a function.

when I remove the current value to be blank I receive the same issue.

here is what I want to do with this array

if(success){
           //do stuff
       }
else{
        //failed_accounts is defined manually in collection variables with current value [] or empty
        let failedAccounts = pm.collectionVariables.get("failed_accounts");
        failedAccounts.push(failed_creds);
        pm.collectionVariables.set("failed_accounts", failedAccounts);
    }

I don’t think you can define complex data structures, such as arrays, from the UI.

You most likely need to create the array from your scripts.

You can enter a variable with a value such as the following in your environment collection (can be done through the GUI
YOUR_VARIABLE [“a”, “b”, “c”]

Then in you POST body of your request you can do something like this

“AllowedScopes”: {{YOUR_VARAIBLE}}

instead of hard coding it like this
“AllowedScopes”: [
“a”,
“b”,
“c”
]