Skip to main content

Notifications

Power Automate - General Discussion
Answered

How to rearrange Array content

(0) ShareShare
ReportReport
Posted on by

Hello dear community

I have the following array

 

[
{
"Tracking Dimension": "NPD"
},
{
"Item Model Group": "NPD"
},
{
"Item Model Group": "NPD"
},
{
"Storage Dimension Group": "NPD"
},
{
"Reservation Hieararchy": "NPD"
},
{
"Product Coverage": ""
},
{
"Batch Number Group": "",
"End Of The Month": "No"
},
{
"Flushing Principle": "Manual"
},
{
"Commodity": ""
},
{
"Customer Hierarchy": ""
},
{
"Attributes": "None"
},
{
"Conversion EA to CS": "Not existing"
}
]

 

 

I would like to rework the array below in the following way.

 

[
{
"Tracking Dimension": "NPD",
"Item Model Group": "NPD",
"Item Model Group": "NPD",
"Storage Dimension Group": "NPD",
"Reservation Hieararchy": "NPD",
"Product Coverage": "",
"Batch Number Group": "",
"End Of The Month": "No",
"Flushing Principle": "Manual",
"Commodity": "",
"Customer Hierarchy": ""
"Attributes": "None",
"Conversion EA to CS": "Not existing"
}
]

How do I achieve this in PA?

 

  • Re: How to rearrange Array content

    It worked nicely.

    Thank you very much

  • Verified answer
    Ellis Karim Profile Picture
    Ellis Karim 10,547 on at
    Re: How to rearrange Array content

    Hi @Anonymous ,

     

    You can try this method:

    Snag_9ebe570.png

     

    Convert the data array into a text string,  replace each occurence of the substring  },{  with , (comma), then convert the result back into a (JSON) array: 

    Snag_9efd3ba.png

    json(replace(string(variables('varData')), '},{',','))

    json(replace(string(variables('varData')), '},{',','))

     

    Here is the sample runtime output:

    Snag_9f557b6.png

    [
     {
     "Tracking Dimension": "NPD",
     "Item Model Group": "NPD",
     "Storage Dimension Group": "NPD",
     "Reservation Hieararchy": "NPD",
     "Product Coverage": "",
     "Batch Number Group": "",
     "End Of The Month": "No",
     "Flushing Principle": "Manual",
     "Commodity": "",
     "Customer Hierarchy": "",
     "Attributes": "None",
     "Conversion EA to CS": "Not existing"
     }
    ]

     

    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard