web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Remove [ ] Brackets fr...
Power Automate
Answered

Remove [ ] Brackets from single object array

(1) ShareShare
ReportReport
Posted on by 1,278 Super User 2024 Season 1

Hello, 

 

I have the follwing array which I get from a SQL import, filtered and is now a single object array. It is stored like this in a compose action: 

[
{
"ShipmentNumber": "1005",
"Analysis1": 23,
"Analysis2": 135655,
"Analysis3": null,
"Analysis4": 0,
"Analysis5": "10",
"Analysis6": "7"
}
]

 

I would like to remove the brackets [ ] from the start and end of the array, since these are creating some issues and using the values further. I would like to have the array in the exact same format. 

 

I tried the follwing: 

 

replace(replace(outputs('withBrackets'), '["', ''), '"]', '')

 

But I get the follwing errormsg: 

 

Heartholme_1-1641556052018.png

 

Any help would be really appriciated. 

 

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Since its an array you need to convert to string()

     

    Try the following

     

    replace(replace(string(outputs('Compose')),'[',''),']','')
  • Heartholme Profile Picture
    1,278 Super User 2024 Season 1 on at

    @abm 


    Thanks a lot, I learned something new.

  • letsflow Profile Picture
    4 on at

    Hello,

    I am running into the same issue. 

    I am trying to avoid using substring as it converts the array to a string and adds additional \ which I am unable to remove when using an append-to-string action. 

    Is there a way to:

    A) remove the array [] without converting to string, OR

    B) remove \ from a string? (I have tried the following:

                      replace(output('actionname'),'\','')

                      replace(output('actionname'),'\\','')

                      replace(output('actionname'),'\"','"') 

    but none of the worked.

    Thanks in advance.

     

  • Community Power Platform Member Profile Picture
    on at

    I am having the same issue. Need a way to remove the square brackets without it adding backslashes. I've tried this into an array variable, which works but it cuts the dataset to a single array (from multiple): array(json(replace(replace(string(outputs('Merged_Data')),'[',''),']',''))). I think I need a way to convert it back to Json without cutting the dataset.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard