cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to Parse json data and store particular data in the initialized variable

Hi All,

 

I am creating a flow to send emails to users . My list has around 45k items in it . I created below flow to fetch all my items in less time . Now I am trying to separate the site title, owners , admins into different variables but got confused how to do it. can anyone guide me to proceed further.

KanwalKaurSaini_0-1627574943803.png    

KanwalKaurSaini_1-1627574971422.pngKanwalKaurSaini_2-1627575004530.pngKanwalKaurSaini_3-1627575108629.png

I am basically concerned about collecting admin and owners details into separate variables . I am stuck and facing challenges in getting these two fields data appended into my variables created at beginning .

Can anyone in the forum guide me on this . 

 

Thanks for the help in advance.

 

9 REPLIES 9
Nived_Nambiar
Post Prodigy
Post Prodigy

Hi @KanwalKaurSaini 

For extracting the data from json body you can try as below

 

1. After using the parse json, utilise the body parameter which is coming as output from parse json

 

for eg: i had used a json like this 

{
  "name""nived",
  "std"5
}
 
To extract the name, i used the body variable of the Parse Json output
 
Nived_Nambiar_0-1627584063257.png

 

 

Now used this expression to extract the name data from the json

 

body('Parse_JSON')?['name'] 
 
In simmilar u will able to extract the required data as well
 
Mark it solution if it resolves ur query
Regards,
Nived N
Thanks & Regards,
Nived N

Hi ,

 

I used as you suggested but the output is blank in my case evwn though flow ran successfully.

 

I used as below to extract tittle of the sites for eg but it gave blank page when i try to download the output.

KanwalKaurSaini_0-1627622663782.png

 

Nived_Nambiar
Post Prodigy
Post Prodigy

Hi @KanwalKaurSaini 

Is it possible to share the sample json here so that i can check and respond back?

Thanks & Regards,
Nived N

hi 

 

this is part of sample json . I want to extract siteowners, admins separately now .

 

 

Nived_Nambiar
Post Prodigy
Post Prodigy

Hi @KanwalKaurSaini 

In your case, you had loop through the parsed json output and get the indiviual items from it

 

I had taken json like this 

Nived_Nambiar_0-1627626129512.png

 

 

Now after parsing json i used Apply For Each action to loop through each element of body and extracted the required data

like as below

Nived_Nambiar_1-1627626205267.png

 

In compose i had used the expression to extract the name from json 

expression as below 

items('Apply_to_each')?['name']  
 
Now i got result like this 
Nived_Nambiar_2-1627626317369.png

 

Nived_Nambiar_3-1627626334982.png

 

 

Mark it as solution if it helps

Regards,

Nived N

 

Thanks & Regards,
Nived N

Thanks for it . let me try once and will update you if it works .

Hi ,

 

Thanks for the help . The way you guided worked for me. i need more assistance for further steps . I am able to extract my owners and admins into two variables separateley . total no of users are around 4200. Now I have to check for every user how many sites they are owner or admin and list out those . I tried with by hardcording one user in filter array action but got some errors . 

Hi ,

 

I am getting desired values . Now when I try to collect all values in my variable it gives me error "The variable of type 'Array' cannot be initialized or updated with value of type 'String'. The variable only supports values of types 'Array'". how i can have unique values of my owners and admins in my variables initialized at the beginning.

Thank you so much, you just saved my butt over here. I was confusion. I didn't know how to store certain variables from a filtered array, so I could send the filtered data by email. I wanted to let you know how thankful and grateful I am to your solution which finally got the core functionality of my flow up and running.

 

Cheers and have a nice day!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,395)