Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Get access to multiple elements of array outside of loop


I have some JSON data, that looks like this:


 "hs_code": [
      "type": "custom",
      "number": "30049000"
      "type": "custom",
      "number": "90258040"
  "statistic_value": [
      "key_0": "226800  DKK"
      "key_0": "0  DKK"

 I want to access this data and send it all in an e-mail to myself, formatted like this:


Hi Oliver

Please see below data:

HS Code:
226800 DKK

However I cannot figure out how to get all values from the JSON object. I have tried creating a For Each loop, but here I can only loop through either "hs_code" OR "statistical_value". And I am not even able to access the variable outside of the loop.

Can anyone assist me in creating above flow? Sounds really simple in my head, but I find it very hard to do in Flow.



Community Support Team
Community Support Team

Re: Get access to multiple elements of array outside of loop

Hi @oliverbusk,


I have made the following test, please take it for a reference.

The flow is triggered by a button.

Initialize variable, Name set as type, Type set as Object, Value set as the JSON schema you provided.

Add a Compose action, input the following code:


Add a Compose 2 action, input the following code:


Then in the send an email action, enable Yes for the Is HTML field, and select the dynamic contents from Compose and Compose2 in the email body.

Please check it for a reference and try with the remaining part on your side.


There is blog for your reference: 


Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Re: Get access to multiple elements of array outside of loop

Hello, @oliverbusk!

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

Thank you for being an active member of the Flow Community!

Flow Community Manager

Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,660)