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 / Converting an input fo...
Power Automate
Answered

Converting an input format to another format

(0) ShareShare
ReportReport
Posted on by 72

Hi:

I have the following format in the flow (below) and needed to convert to another format (below - Output). Is this possible?

Format in Flow:

[

  {
    "FileName": "abc.pdf",
    "rpa": "true"
  },
  {
    "FileName": "abc.pdf",
    "robotic process automation": "true"
  },
  {
    "FileName": "abc.pdf",
    "process automation": "true"
  },
  {
    "FileName": "pqr.pdf",
    "rpa": "true"
  },
  {
    "FileName": "pqr.pdf",
    "robotic process automation": "false"
  },
  {
    "FileName": "pqr.pdf",
    "process automation": "true"
  }
]

 

But need to convert to this format (output):

[
  {
    "FileName": "abc.pdf",
    "rpa": "true",
    "robotic process automation": "true",
    "process automation": "true"
  },
  {
    "FileName": "pqr.pdf",
    "rpa": "true",
    "robotic process automation": "false",
    "process automation": "true"
  }
]

Categories:
I have the same question (0)
  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @Tak103 I'm not sure this is the best way to approach for this can you not change the way the information is passed to the Power Automate?

     

    Have this in the correct format rather than having multiple lines for each pdf can you not collect this together and then pass it as the desired output? Doing this dynamically would prove difficult? 

     

    Try passing information as this in the 1st instance: 

    [
    {
    "FileName": "abc.pdf",
    "rpa": "true",
    "robotic process automation": "true",
    "process automation": "true"
    },
    {
    "FileName": "pqr.pdf",
    "rpa": "true",
    "robotic process automation": "false",
    "process automation": "true"
    }
    ]

     

    I did try using Select data operation but this wouldn't give me the desired out put this would just create multiple PDF items and append the additional columns as null values:

     

    AndrewR1_0-1696259628702.png

     

    Sorry I couldn't help any further 

    Andrew 

  • Verified answer
    SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    @Tak103 ,

     

    You could try converting the following Powershell code into workflow logic.

     

    $json = @"
    [
    {
    "FileName": "abc.pdf",
    "rpa": "true"
    },
    {
    "FileName": "abc.pdf",
    "robotic process automation": "true"
    },
    {
    "FileName": "abc.pdf",
    "process automation": "true"
    },
    {
    "FileName": "pqr.pdf",
    "rpa": "true"
    },
    {
    "FileName": "pqr.pdf",
    "robotic process automation": "false"
    },
    {
    "FileName": "pqr.pdf",
    "process automation": "true"
    }
    ]
    "@

    $data = ConvertFrom-Json $json

    $result = @{}
    $data | ForEach-Object {
    $fileName = $_.FileName
    if (-not $result.ContainsKey($fileName)) {
    $result[$fileName] = @{
    "FileName" = $fileName
    }
    }
    foreach ($key in $_.PSObject.Properties | Where-Object { $_.Name -ne "FileName" }) {
    $result[$fileName][$key.Name] = $key.Value
    }
    }

    $finalResult = $result.Values

    $finalResult | ConvertTo-Json
  • Tak103 Profile Picture
    72 on at

    Thanks. This works

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 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard