In this Power Automate tutorial, I will explain how to initialize an array variable in Power Automate.
We will check out the topics below with examples:
- Power Automate initialize Array Variable
- Power Automate initialize Array Variable json
- Power Automate initialize Array Variable of objects
- Power Automate initialize Array Variable function
- Power Automate append to an array variable
- Power Automate initialize a variable array of empty
- Power Automate initialize an array with multiple values
Array Variable in Power Automate
- An array is a collection of values of the same data types. For example, if it is an integer array, the array values will be [1,2,3..]; there is no need for a double quote mark.
- In the same way, if it is a string array, then the array looks like [“a”, “b”, “c”…] within a double quote mark. And for the dynamic content of array item values no need for a double quote mark, even if it is a string value.
How to Initialize Array Variable in Power Automate
Here, we will see how to initialize an array variable in Power Automate.
In this example, we will initialize the string array to display the TaskName, TaskPriority, and Status values in the array format. Follow the below steps:
Step-1:
First, you need to create an instant cloud flow using Microsoft Power Automate. Then Add the “Initialize Variable” flow action.
- Enter the name and type of the variable as an array, and add the dynamic content values in the values field.

Step-2:
After initializing the array variable, add a compose action to retrieve the array data values from the SharePoint list on Power Automate.

- To run the Power Automate flow, select the Test option, choose Manually, and click the Save & Test option.
- Once the Power automation flow is triggered and runs, we can see the array of data values from the SharePoint list in the compose output section as below:

This is how to initialize the variable with the Array data type in Power Automate.
Power Automate initialize Array Variable of JSON
Let us see how we can initialize the Array Variable of JSON in Power Automate flow,
Before following the steps, we should know the syntax of the JSON format:
JSON data is known as name/value pairs. The name/value pair consists of a field name in double quotes, followed by a colon, followed by a value. The below syntax code is an example of JSON format.
"name":"John"
Follow the below steps to initialize a variable array of JSON
In this example, we will pass the username and user email as dynamic input content in the array-type format. In the compose action, we will see the encoded values of the username and user email of the person who triggered the flow in Power Automate.
Step:1
Open the Power Automate and create an instant flow by selecting the manual trigger as displayed below:

Step:2
- Select an action to initialize the variable in an array-type format as displayed below:
- Enter the variable name and then select the variable type as an array.
- Add the JSON format data values in the values field by choosing the dynamic content values. Here, we pass two values inside the array in JSON format.
[ {"name":@{triggerOutputs()['headers']['x-ms-user-name-encoded']}} , {"email":@{triggerOutputs()['headers']['x-ms-user-email-encoded']}}]
Where, (JSON key-value pairs)
- name and email = (JSON Keys)
- user-name and user-email = dynamic content values (JSON Value)

Step:3
- After initializing the array variable, add a compose action to retrieve the array data values from the initialized variable on Power Automate.
- Click the Save & Test -> option to save and test the Power Automate flow.

Step:4
- Choose Manually under the test option and select Run Flow. Once the Power automation flow is triggered and runs.
- We can see the output in the Compose action below, where the user name and user email are in the encoded value inside the Array in JSON format.

This is how to initialize variable array of JSON in Power Automate flow.
Power Automate initialize Array Variable of objects
Here, we will see how to initialize the Array Variable of objects using Power Automate.
Here, we will initialize a variable and then create an array, where each item in the array has an object with its properties. We will unite the two arrays of objects.
- Once the Power Automated instant flow has been created, select an action to initialize the variable in an array format as displayed below:
- In this example, we will initialize two variables and select the variable type as an array. In the values section, add the array of object items.

- Now, we will unite the two arrays of objects using the Union function to get the array items in a single array object.
- So click on the Next step and select compose action, and in input, write the below expression:
union(variables('VarArray'),variables('VarArray2'))

- Now click on Save and run the flow manually; we can see the result in the compose action output.

This is how to initialize variable array of objects using Power Automate.
Power Automate initialize Array Variable function
Let us see how we can create an array function with the initialized variable in Power Automate.
Once the Power Automated instant flow has been created, select an action to initialize the variable in an array format using the create Array function as displayed below:
createArray('SharePoint','Power BI','Power Automate')
Where,
- CreateArray = Function Name
- SharePoint, Power BI, Power Automate = Array items

- Add a compose action to see the output for the initialized variable in an array format.
- Click save to save the Power Automate flow.

To test the flow, select Test Flow -> Manually -> Run Flow. Once the Power automation flow is triggered and runs. We can see the output in the Compose action below:

This is how to create an array function with the initialized variable in Power Automate.
Power Automate append to an array variable
Here, we will see how we can append to an array variable in Power Automate,
In the Previous heading, you can see that we have created an array using the CreateArray function and initialized a variable. So now we will see how to append an array item to the existing created array variable.
In the below screenshot, you can see that the array variable has been created.

- Now we will add or append the array value to the existing array variable using the Append to array variable action.
- For that, select the +New step and choose Append to array variable action. Then in the Name section, select the existing array variable that we created, and in the Value section, add the values that you want to append to the existing variable.
- I will append the PowerApps as an array value with the existing array variable.

Select +Newstep -> Compose action to see the output of the initialized variable.

Now click Save&Test and run the flow manually; we can see the result in the compose action output.

This is how to append to an array variable in Power Automate.
Power Automate initialize Array Variable of empty
Let us see how we can initialize an Array Variable of empty in Power Automate,
- Once the Power Automated instant flow has been created, select an action to initialize the variable in an array format.
- Enter the name and type of the variable as an array, and in the values field, add an empty array as [] as highlighted below:

Add a compose action to see the output for the initialized variable in Power Autome. Click Save to save the flow:

- Once the Power Automate flow has run, in the compose action, we can see it displays a link Click to download instead of showing on compose’s output.
- So when we click on the click to download option, it displays

This is how we can initialize variable array of empty in Power Automate flow.
Power Automate initialize an array with multiple values
Here, we will see how we can initialize an array with multiple values using the Power Automate flow.
- Once the Power Automated instant flow has been created, select an action to initialize the variable in an array format as displayed below:
- Enter the name and type of the variable as an array, and in the values field, add the multiple values in it.

- After initializing the array variable, add a compose action to retrieve the array data multiple values from the initialized variable on Power Automate.

- To see the output for the initialized variable in Power Autome. Click Save to save the flow and test -> Manually Test -> Run Flow

- The screenshot below shows that the compose action displays the array data with multiple values.

This is how to initialize an array with multiple values using the Power Automate flow.
In this Power Automate tutorial, we have learned what is Power Automate Array Variable is and how to initialize a variable for an Array data type in Power Automate with different examples.
Moreover, we also learned the below-related topics:
- Power Automate initialize Array Variable
- Power Automate initialize variable array json
- Power Automate initialize variable array of objects
- Power Automate initialize Array Variable of empty
You may also like the following Power Automate tutorials:
- How to Initialize String Variable in Power Automate
- How to Initialize Variable Condition using Power Automate
- How to Work With Set Variable Action in Power Automate
- Set Variable Based on Condition in Power Automate
Bijay Kumar Sahoo is a highly accomplished professional with over 15 years of experience in the field of SharePoint and related technologies. He has been recognized as a Microsoft MVP (Most Valuable Professional) more than 9 times, starting from April 2014, for his exceptional contributions to the SharePoint community. Bijay is also a prolific author, having written two books on SharePoint – “Microsoft Power Platform – A Deep Dive” and “SharePoint Online Modern Experience Practical Guide“. His deep insights into SharePoint are also shared on his popular YouTube channel EnjoySharePoint where he teaches SharePoint to a global audience (From various countries like the United States of America, Canada, the United Kingdom, Australia, New Zealand, etc). Read more…