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 / Merging multiple JSON ...
Power Automate
Suggested Answer

Merging multiple JSON collections.

(0) ShareShare
ReportReport
Posted on by
Hello,
 
I have a flow that loops through several HTTP requests, receiving a collection of JSON objects in each iteration.    I would like to combine these collections into a single collection and add the data into a csv file.  Each JSON collection will have the exact same properties, so I imagine this should be pretty straightforward.  I'm just new to this and having a hard time figuring it out.
 
Thanks!
 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
    Hi :-)
     
    As you look through you have a couple of options
     
    1. You can use a union to continually merge the data in a compose, which will be cumulative, but you have to make sure you only have, under settings, Concurrence set to 1, this will remove duplicates as well if you want that
     
    2. You can use Join
     
    3. You can use a blank array (initialize it at the top) and you can append the data to the array after each call
     
    4. You could create the file and then for each iteration use UpdateFile to essentially append the next set of data
     
    I am not sure that creating one giant one is the right play since I do not know how many rows you have in each call, so update file might be best.
     
    if its a small amount, then either use union/join or append it all to a blank array and then write it after your loop
     

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
     
     
  • Chriddle Profile Picture
    8,708 Super User 2026 Season 1 on at
    Flatten an array is easy with xpath:
    From:
    xpath(
    	xml(
    		addProperty(
    			json('{}'),
    			'Root',
    			addProperty(
    				json('{}'),
    				'Item',
    				outputs('Compose')
    			)
    		)
    	),
    	'/Root/Item/*'
    )
     
    Map:
    json(item()).Item
     
    Result:
    [
      {
        "id": "0"
      },
      {
        "id": "1"
      },
      {
        "id": "2"
      },
      {
        "id": "3"
      },
      {
        "id": "4"
      },
      {
        "id": "5"
      },
      {
        "id": "6"
      },
      {
        "id": "7"
      },
      {
        "id": "8"
      },
      {
        "id": "9"
      },
      {
        "id": "10"
      },
      {
        "id": "11"
      }
    ]
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard