Showing results for 
Search instead for 
Did you mean: 
Not applicable

JSON Iterating through an Array for specific values

Hi all, I'm trying to output just the 'answer' values that are found under 'subquestion' at the JSON here:


I can ParseJSON and convert that Body to an array variable. But I don't know how to iterate through the array just to extract the values for 'answer'. Any help would be appreciated.

Memorable Member
Memorable Member

Hello @Anonymous 


My guess is that your array has one item and in that one item is a another array - the "data" - which contains all the survey data.


You will have to loop (apply to each) through both your one item and your "data" arrays. The inner loop (apply to each) for the "data" array will allow you to access the questions/answers. 

Getting the first question and answer: item()?['survey_data']?['19']?['subquestions']?['20']?['question'] and item()?['survey_data']?['19']?['subquestions']?['20']?['answer']


This you have to do for all your subquestions in the "data" using their respective paths!

Hope this helps you on the way 🙂

Kind regards, John

Not applicable

@JohnAageAnderseIs there a way I can loop through it without specifying the ['19'] or ['20']? Something like iterate through all child elements..I dunno:/

Hello @Anonymous 


Did you find a solution for this yet? Anyway I found that using a Select action, it is possible to create an object with the questions and answers for easy use.

With your JSON data element as input (From) to a Select action, you can then map each question and answer.


Each map needs a name (the question) and a value (the answer), so using expressions in both name and value field as follows:

Name expression: item()?['survey_data']?['19']?['subquestions']?['20']?['question']

Value expression: item()?['survey_data']?['19']?['subquestions']?['20']?['answer']

This you do for all the questions/answers that you need.


Note that under element "77", some of the questions are the same as under element "19", so I added "Contact " before the expression to avoid naming conflicts!

Hope the above helps you 🙂

Kind regards, John

Helpful resources

MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,751)