cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
timalex
Helper I
Helper I

Unable to use results of JSON Parse in Flow

I need to use the results of my Parse JSON action to complete an apply to each action and each time i try the value of 'ID" is coming thru as NULL. 

 

If i hardcode the value that i get from my Parse JSON output into the HTTP action it works fine, but that's defeating the purpose to try and automate it. 

 

 

timalex_0-1623840751701.png

 

 

timalex_1-1623841006630.png

 

This is what happens when it is contained in a Apply to Each Action

timalex_2-1623841093160.png

The error is:

 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON_2')?['id']' is of type 'Null'. The result must be a valid array.

 

timalex_3-1623841181616.png

What the heck am i missing here?

 

This should be easier than it is. 

1 ACCEPTED SOLUTION

Accepted Solutions
timalex
Helper I
Helper I

So the answer for some reason is to parse the body of the first JSON parse of the API body. Have no idea why that worked, and at this point don't care. 

 

timalex_0-1623878040640.png

 

View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @timalex,

 

In your error message it says it is referring to a Parse Json action with the name 'Parse JSON 2'. However, in your screenshot the name of the action is Parse JSON to then perform a ForEach Retry SSL Validation.

 

Is the reference to the id field correct in your HTTP request action?

 

I would have expected this:

body('Parse_JSON_to_then_perform_a_ForEach_Retry_SSL_Validation')?['id']

 

timalex
Helper I
Helper I

So that's a very good catch, my screenshots are from different iterations of that flow which is why you've caught that. 

 

Please let me know what information i can provide that will help you help me. I really need to get this thing working and i don't understand why i can't USE the data in the JSON to kick off a apply for each on my HTTP patch call. 

 

i appreciate the help. 

timalex
Helper I
Helper I

So the answer for some reason is to parse the body of the first JSON parse of the API body. Have no idea why that worked, and at this point don't care. 

 

timalex_0-1623878040640.png

 

View solution in original post

timalex
Helper I
Helper I

Oh, and i failed to mention that you use the dynamic results from the SECOND 'ParseJSON' action within your Apply to each action. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,466)