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

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.

 

8 REPLIES 8
Nived_Nambiar
Resolver I
Resolver I

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

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
Resolver I
Resolver I

Hi @KanwalKaurSaini 

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

hi 

 

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

 

 

Nived_Nambiar
Resolver I
Resolver I

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 for it . let me try once and will update you if it works .

KanwalKaurSaini
Helper I
Helper I

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.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Users online (3,246)