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 / List rows present in a...
Power Automate
Answered

List rows present in a table to JSON

(0) ShareShare
ReportReport
Posted on by 18

Good day

i am busy working on a flow that loops through a large excel sheet using list items present in a table.it fetches it in batches of 5000.I then compose to get the JSON output. the question i have is it gives me 12 outputs of Compose and  i need to combine all outputs into one output.

TiaanHarmse_0-1682788168613.png

 

Categories:
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @TiaanHarmse 

     

    You have to initialize an array at start of flow and then after select action in the loop, use append to array action to append each element to the array which has been intialized earlier.

     

    refer the flow 

    Nived_Nambiar_0-1682822154522.png

     

    Nived_Nambiar_1-1682822169042.png

     

    Nived_Nambiar_2-1682822196553.png

     

    Nived_Nambiar_3-1682822213817.png

     

     

    Thus the array will contains all rows values from all tables.

     

     

    Hope this helps

     

     

  • Pstork1 Profile Picture
    69,028 Most Valuable Professional on at

    @Nived_Nambiar The one problem with initializing an array variable is that using arrays in a loop will slow you down and prevent the full use of concurrency. When working with large data sets this can cause a flow to run for hours instead of minutes.  I had one flow that worked this way that took 10 hours. Enabling concurrency in the loop got it down to about 7 hours.  Using Compose to generate an array dropped it to around 35 minutes. The change can be dramatic.

     

    So I will suggest an alternative. If you know how many compose() arrays you will have you can use Union() to join two arrays together into a single array. The issue is that without recursiveness you need to know how many arrays you are combining.  Or you have to use a child flow and create an array of arrays.  Then once you have all the output arrays you can process them using an apply to each loop to append them all to the array variable.  But by then you are working with a loop of 11-12 instead of thousands.

  • Verified answer
    Nived_Nambiar Profile Picture
    18,136 Super User 2026 Season 1 on at

    Hi @Pstork1 

     

    Actually i was also thinking same, but could not find any way to merge array, i have seens some article where they are merging arrays using common value in both array, in this case, i couldn't try that approach.

     

    But when u mentioned about union, i then got it how to make it faster. Usually use union for getting unique, so forget about this usage here. Thanks for reminding that.

     

    I think we can make the use of union here like below

     

    Nived_Nambiar_0-1682824075375.png

     

    Nived_Nambiar_1-1682824094015.png

     

    Nived_Nambiar_2-1682824113597.png

     

    expression used: 

    union(variables('temparr'),body('Select'))
     
    I hope this logic would work 
     
    @Pstork1 , could you confirm this ?
     
  • takolota1 Profile Picture
    4,978 Moderator on at

    @Nived_Nambiar @Pstork1 

     

    There is a different way to accomplish this that is faster & will handle large datasets (I think variables are limited to less items / characters than composes).

     

    If you have a Compose from a loop & reference it from outside a loop, then it will create an array of each compose output from the loop.

    So if one is sending List rows output to the compose, then it will be an array of JSON arrays…

    [
    [
    {

    key1: value1,

    key2: value2

    },

    {

    key1: value1,

    key2: value2

    }

    ],

    [
    {

    key1: value1,

    key2: value2

    },

    {

    key1: value1,

    key2: value2

    }

    ],

    [
    {

    key1: value1,

    key2: value2

    },

    {

    key1: value1,

    key2: value2

    }

    ]

    ]

     

    So if you can reformat the data to just a single JSON array, then you will have combined the outputs.

     

    For that you will want to put a Compose outside the loop & use an expression like…

     
    json(replace(string(InsertLoopComposeDynamicContentHere), '}],[{', '},{'))


    That will return a single JSON array with all your values that you can then Parse and work with in the rest of your flow.

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard