“I’ve got an array where each property is a separate object, how can I turn it into a single object using Power Automate flow?”
If you stay only in the Microsoft 365 environment, you probably won’t encounter this problem. Every array is either a simple array or an array with objects. But once you start processing data from other systems it might not be as clear. Instead of a single object you might receive an array of objects with each object representing one property. A format that can make your life quite complicated.
How do you turn it into a single object that’s easy to work with?

Convert the array into a string
I believe that the easiest way is to “brute force” the conversion.
To turn it into a single object you must remove the },{ between the objects and replace them with a comma. But to use the replace(…) expression you’ll need a string, not an array.
string(outputs('Compose'))

Replace the },{ characters
Once you have a string, you can replace some parts of it. In this situation you should replace the },{ with a single comma.
replace(string(outputs('Compose')),'},{',',')

Turn it back into an array
The string now resembles the object, but it’s still a string. You can’t select a value from a string, nor can you navigate in an array-like looking string. You must turn it back into an array with an object using the json(…) expression.
json(replace(string(outputs('Compose')),'},{',','))

Remove the array
The last step is to remove the [ ] brackets representing an array as you don’t need it anymore since it’s a single object. Use the first(…) expression to take only the first (and only) object.
first(json(replace(string(outputs('Compose')),'},{',',')))

And that’s it, you just turned an array of objects into a single object in your Power Automate flow.
Summary
You don’t need a fancy solution for everything when using Power Automate. Sometimes it’s fine to just adjust the data and force it into the desired format. All you have to do is follow your thought process – how would you do that step by step? Turn it into a combination of expressions and move on.
Hi, thanks for your shares.
What about if I d like to use “append to array variable” action, in a context of apply to each (preventing me from using set variable action in concurrency) ?
The append to array value can’t have the brackets…
Thanks
Hello Joseph,
I’m not sure that I understand the situation, but one of the steps in the blog post is removing the [ and ] brackets using the first(…) expression.