cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

How to get value of array from a JSON Object using Apply To Each

Hi, everybody

I want to get 'C' value when 'B' equals 1 

How can I use it?

 

2018-01-05_11h42_41.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to get value of array from a JSON Object using Apply To Each

Hi @Eric_Hu,

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> “Initialize variable” action, Name set to J, Type set to Object and Values set to object that you provided.
  • Add a “Compose” action, Inputs set to following formula:
variables('J')?['A']
  • Add a “Apply to each” action, input parameter set to output of “Compose” action.
  • Within “Apply to each” action, add a Condition, click “Edit in advanced mode”, type the following formula:
@equals(items('Apply_to_each')?['B'],'1')
  • Within “If/yes” branch of Condition, add a Compose 2 action, Inputs field set to following formula:
items('Apply_to_each')?['C']

Image reference:1.JPG

 

2.JPG

The flow works successfully as below:3.JPG

 

4.JPG

 

Best regards,

Kris

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

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: How to get value of array from a JSON Object using Apply To Each

Hi @Eric_Hu,

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> “Initialize variable” action, Name set to J, Type set to Object and Values set to object that you provided.
  • Add a “Compose” action, Inputs set to following formula:
variables('J')?['A']
  • Add a “Apply to each” action, input parameter set to output of “Compose” action.
  • Within “Apply to each” action, add a Condition, click “Edit in advanced mode”, type the following formula:
@equals(items('Apply_to_each')?['B'],'1')
  • Within “If/yes” branch of Condition, add a Compose 2 action, Inputs field set to following formula:
items('Apply_to_each')?['C']

Image reference:1.JPG

 

2.JPG

The flow works successfully as below:3.JPG

 

4.JPG

 

Best regards,

Kris

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

View solution in original post

Highlighted
Advocate I
Advocate I

Re: How to get value of array from a JSON Object using Apply To Each

Hi @v-xida-msft

 

Perfect!!! I can work.

"items('Apply_to_each')?['C']" is I want to know!!!

 

Thank you very much!!!

Highlighted
Advocate II
Advocate II

Re: How to get value of array from a JSON Object using Apply To Each

Hi @v-xida-msft

 

I got a similar issue here, do you have any idea to solve it?

My flow scheme share as follows the link:

https://drive.google.com/file/d/1m_zFgFYUxs2JZFoQc27ENnzVZTW0ZZlm/view

The scheme explains:

Send an HTTP request to take the excel file form SharePoint and invoke the excel's data from HTTP, finally retrieve the pure data form "value", this way is good for avoiding the SharePoint's versioning setting of "Require Check out" and don't need to format the excel file to be the table type, also quick and efficiently, but I stuck with the data after invoking from HTTP, please see below photo for the data get from "Value" and names it rows: 

https://drive.google.com/file/d/1t32RDFPeorDH5aChbsMxV0ryGUwnUMts/view

[

[
"No",
"CD",
"CAT",
"Sub CAT",
],
[
2,
"Add1",
"Test1",
"format3",
"Yes",
"No",
]
[
3,
"Add2",
"Test2",
"format3",
"No",
"No",
]
]
The data has no title, I would like to make the rows has a title, just like below content, because I need the title for each of the rows to define each row to apply to the SharePoint list:
[
"No": "2",
"CD": "Add1",
"CAT": "Test1",
"Sub CAT": "format3",
],
[
"No": "3",
"CD": "Add2",
"CAT": "Test3",
"Sub CAT": "format4",
]
]
 
I try to use the Select to convert it, but no idea how to get it, cause the "value" content no title for formula to quote.
Refer to some article(below link) but their issue has a title and no need to overcome this situation, if you have some idea, please advice, thank you.

https://powerusers.microsoft.com/t5/Building-Flows/How-to-retreive-or-calculate-minimum-and-maximum-...

 

Regards,

ilu989

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (6,667)