Concatenate properties of a JSON array in Power Automate/ Microsoft Flow

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com
Lately I have been working on Power Automate a lot. And if you have worked on Power Automate more often than not, you must have used the Compose Action.
And one of the compose Action is “Data Operations – Select”. And in-fact I wrote a detailed article on this few days back.


However post this blog is dedicated for one of my blog reader who requested for this specific functionality. And in-fact we can do this using the same Compose action. After all reader is KING!
image
Long story short. The requirement is basically this one. The flow is receiving an array of multiple addresses. And inside each address, there are fields like Steet, City, Country and Pin code.

[
    {
       "Street": "2914 Harry Hines",
       "City": "Dallas",
       "State": "TX",
       "Country": "US",
       "Pin":  75201
    }
]

What was required was to concatenate the properties and form an address and each of the address properties should be separated by comma. And then add this Address as additional property of the JSON array.
Well quite easy. Let’s see show the flow can do this.


All we need to do use the select data operation and use an expression to contact the properties to form the desired address.
image
Expression –
concat(item()[‘Street’], ‘,’, item()[‘City’], ‘,’, item()[‘State’], ‘,’, item()[‘Country’], ‘,’, item()[‘Pin’])
Observe we are actually adding an Additional Property to the JSON called Address, which is the comma separated value for all other properties in the JSON array
Now when I run this, below is the output I get.
image
Awesome isn’t it?
Hope this helps!
Debajit Dutta
(Microsoft MVP)


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading