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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How do you loop throug...
Power Automate
Answered

How do you loop through JSON objects with Power Automate Desktop?

(0) ShareShare
ReportReport
Posted on by 139

We are using the Invoke Web Service action to retrieve some json, but when we go to loop through the list of items in the json, it doesn't work.  Currently, we are doing this:

 

1) Using the Convert JSON to custom object to turn out json string into a workable object.

2) Using the Add item to list action to add the custom object from step #1 to a new list

3) Using a For each loop to parse the new list, but the conversion to list (step #2) seems to fail to break up the json into separate items, but instead the list just has one massive item (all of the json).

 

Any idea on how to loop through json with Power Automate Desktop?

 

 

I have the same question (0)
  • Verified answer
    drake Profile Picture
    139 on at

    We resolved this issue by referencing the collection in the loop.  It seems that we were at first, but figure out needed syntax.  

  • dt_rpa Profile Picture
    5 on at

    can u pls give examples?  I need to see the formatting. thx in adv

  • Pavibhau_3698 Profile Picture
    18 on at

    where have you resolved I have the same issue 

    We are using the Invoke Web Service action to retrieve some json, but when we go to loop through the list of items in the json, it doesn't work.  Currently, we are doing this:

     

    1) Using the Convert JSON to custom object to turn out json string into a workable object.

    2) Using the Add item to list action to add the custom object from step #1 to a new list

    3) Using a For each loop to parse the new list, but the conversion to list (step #2) seems to fail to break up the json into separate items, but instead the list just has one massive item (all of the json).

     

    Any idea on how to loop through json with Power Automate Desktop?

  • cprima Profile Picture
    3 on at

    Hello,

     

    stuck at the same step, currently evaluating Microsoft's LowCode offering in my job. Testing a few standard usecases and support channels.

     

    Task: Retrieve data from webservice and persist in csv.

    Attempted solution: 

    76pJkll

     

     

    Error: Variable 'JsonAsCustomObject' must be a list, datatable or datarow.

     

     

    Is there actually any useful implementation in Power Automate Desktop for consuming/processing a custom object? The screenshots in Power Automate Desktop Extract null from JsonAsCus... - Power Platform Community (microsoft.com) seem to suggest it should work!?

  • drake Profile Picture
    139 on at

    Here is what we did to make this work:

    1) Invoke Web Service

    2) Convert JSON to custom object

    3) For each on the custom object (be sure to reference the collection inside the object if there is this is a separate part).

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    After many hours of trial and error and reading everything I could find on the matter, I believe I got what is going on.

     

    If the json collection you are trying to iterate is not an index based array, you cannot iterate using Power Automate Desktop loop functions. You will get an error like this: "it's only possible to iterate a list, datatable or datarow."

     

    On the other hand, if the json collection is index based, you will be able to use loops (ex. "foreach") to iterate each entry.

     

    Example of an index based json collection:

     

    {
     "vulnerabilities":[
     {
     "cvss":"9.8",
     "code":"234234",
     "title":"scary vuln"
     },
     {
     "cvss":"7.8",
     "code":"222222",
     "title":"somewhat scary vuln"
     }
     ]
    }

     

     

     Working sample in Power Automate Desktop

    iterate_json_custom_object.png

     

     

  • shoebsayyed Profile Picture
    2 on at

    For a json file of the following structure : 

    shoebsayyed_0-1652452880658.png

    I did the following : 

    shoebsayyed_1-1652452928156.png

    I have read FileContents as a SingleTextValue

    In the RPA flow above, please do not add the part where I am creating a new list. It's not needed

    In the display message I printed the json object with property: PONumber as follows : 

    shoebsayyed_2-1652452986024.png

    it printed the PONumber as follows : 

    shoebsayyed_3-1652453081425.png

     

     

     

     

  • jiwhite Profile Picture
    500 on at

    Can you do this in Cloud?

  • alvaro_cts_13 Profile Picture
    4 on at

    It would be cool to have more details and images of this solution. I did'n get.

    I still trying to solve. I used a array() function. It worked to separete the lines, but still counld't separete columns in the table (I'm using the 'Aply to Each' loop + 'Add a row into a table' to fullfill a table with data in JSON format).
    For now, the entire register are beeing inserted in a single cell. If anyone have any tip, please send it!

    alvaro_cts_13_0-1696377661773.png

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    This is because the solution is for Power Automate Desktop flows, and you're trying to do it in Cloud flows. Those are two completely different tools. Please post your question as a new topic in this forum to get help: https://powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard