Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Remove [ ] Brackets from single object array

Like (1) ShareShare
ReportReport
Posted on 7 Jan 2022 11:49:49 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. 

 

  • Community Power Platform Member Profile Picture
    on 15 Jun 2023 at 19:35:27
    Re: Remove [ ] Brackets from single object array

    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.

  • letsflow Profile Picture
    4 on 21 May 2023 at 00:56:42
    Re: Remove [ ] Brackets from single object array

    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.

     

  • Heartholme Profile Picture
    1,278 Super User 2024 Season 1 on 07 Jan 2022 at 12:10:19
    Re: Remove [ ] Brackets from single object array

    @abm 


    Thanks a lot, I learned something new.

  • Verified answer
    abm abm Profile Picture
    32,464 Most Valuable Professional on 07 Jan 2022 at 11:56:47
    Re: Remove [ ] Brackets from single object array

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

     

    Try the following

     

    replace(replace(string(outputs('Compose')),'[',''),']','')

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 87

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard