web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / JSON Object get values
Power Automate
Answered

JSON Object get values

(0) ShareShare
ReportReport
Posted on by 353
Hello all,
 
How can i traverse through this json object to grab the values i need which are all of them. I have the first one with:
first(body('Parse_JSON')?['ResultSets']?['Table1'])['item1'] in a compose action, how can i keep nesting through to get the others?
 
Thanks
 
{
            "OutputParameters": {},
            "ResultSets": {
                    "Table1": [
                         {
                                 "item1": 253
                         },
                         {
                                  "item2": 985
                         },
                         {
                                    "item3": 3159
                          },
                          {
                                     "item4": 3712
                          }
                   ]
             }
   }
Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @mmattar 

     

    You can directly use the parse json action to do this: 

    s11.PNG

     

    s12.PNG

     

    s13.PNG

    I stored the json in an array object for the source to the parse json action. You can directly bass the body/ output of previous action here. Click on generate schema and enter the sample payload and it will generate a schema for you. Based on that you will be able to access teh keys as dynamic content then. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • mmattar Profile Picture
    353 on at

    hey thanks for the reply, i implemented what you did but im still not seeing the items as dynamic content to choose from

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @mmattar 

     

    Can you share a screenshot of the flow? Can you confirm the schema has been entered correctly and generated in the JSON action. Also, what is the consecutive action that you have in the flow? If you could share a screenshot it would be easier to identify the issue and assist you with this. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • mmattar Profile Picture
    353 on at

    pp.PNGpp1.PNGpp2.PNG

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @mmattar 

     

    Note that you can only pass strings in the Respond to PowerApps or Flow action and the schema that you generated has array and objects of integers (strings). And to choose even one value, it would put the action in apply to each and you cannot do that for the respond action. 

     

    Based on the data you want to pass, you can add a compose action or a variable to store the data and then pass it to the respond action:

     

    ee3.PNG

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • mmattar Profile Picture
    353 on at

    pp3.PNGok so this is what i am getting back to powerapps, i tried creating a variable for each item, but it seems as if the apply to each control puts all the items in each variable, how can we seperate each item in its own variable

  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @mmattar 

     

    Since you are returning the response as a string, then you might want to perform manipulations in a way that it extracts the value out of it.
     
    Expressions:
     
    1st Item: Substitute(Last(FirstN(Split(var1.test,"{"&Char(34)&"Lunch"&Char(34)&":"),2)).Result,"}","")
    2nd Item: Substitute(Last(FirstN(Split(var1.test,"{"&Char(34)&"Lunch"&Char(34)&":"),3)).Result,"}","")
    3rd Item: Substitute(Last(FirstN(Split(var1.test,"{"&Char(34)&"Lunch"&Char(34)&":"),4)).Result,"}","")
    4th Item: Substitute(Last(FirstN(Split(var1.test,"{"&Char(34)&"Lunch"&Char(34)&":"),5)).Result,"}","")
     
    This will work in a way, you need to update the highlighted part with the index you want to get + 1. 
     
    Else, you could use the Response action (a premimum connector and starightaway pass the json and parse it in PowerApps then)
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • mmattar Profile Picture
    353 on at

    Thanks for all this help, just one more question.

     

    Substitute(Last(FirstN(Split(var1.test,"{"&Char(34)&"Lunch"&Char(34)&":"),2)).Result,"}","") 

     

    In the area i have highlighted red, this is where i put my variable that holds the string of the values i got from the json. but i keep getting that this expression is invalid, here is my expression

     

    Substitute(Last(FirstN(Split(variables('leaks'),"{"&Char(34)&"Lunch"&Char(34)&":"),2)).Result,"}","") 
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @mmattar 

     

    Can you share how you are creating this variable in PowerApps (the expression i shared is for powerapps). Also, variable('leaks') format is used on expressions for Flow. Here, in powerapps, you directly need to pass the variable name: 

     

    Substitute(Last(FirstN(Split(leaks.stirngname,"{"&Char(34)&"Lunch"&Char(34)&":"),2)).Result,"}","") 
     
    leaks is a variable created in powerapps to store the response returned by flow, stringname is the name of the variable from Flow. 
     
    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • mmattar Profile Picture
    353 on at

    just a misunderstanding on my end, thanks it works ! 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard