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 Automate
Unanswered

Simplify an array

(0) ShareShare
ReportReport
Posted on by 34

I'm trying to create an array without the object labels (I believe that's what they're called).  The goal is to also remove any null objects but I believe I can use the select function to remove that. 

To explain it in more simple terms...

The current output that I want to fix is this:
[
{
"Keyword": "Keyword1"
},
{
"Keyword": "Keyword3"
},
{
"Keyword": "Keyword5"
},
{
"Keyword": "Keyword6"
},
{
"Keyword": "Keyword2"
},
{
"Keyword": "Keyword4"
},
{
"Keyword": null
},
{
"Keyword": "Keyword7"
},
{
"Keyword": "Keyword8"
},
{
"Keyword": "Keyword9"
}
]

 

What I want that array to look like is this:

[
"keyword1",
"keyword3",
"keyword5",
"keyword6",
"keyword2",
"keyword4",
"keyword7",
"keyword8",
"keyword9"
]

 

This is the output in a Compose action. Which is honestly taking the inputs of another compose that used the Union expression to remove duplicates. 

Compose_Action.png

Does anyone have any thoughts on how I can remove the curly brackets and the "keyword" label in front of what will have real keywords?

Categories:
I have the same question (0)
  • Verified answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    Hi @NewName896452 ,

     

    (1) This is your sample data:

    Snag_2616181b.png

     

    (2) Use the Select action in key-value mode:

    Snag_26157803.png

     

    and enter the data and values as shown:

    Snag_2617f901.png

    The Select action produces the following array:

    [
     "Keyword1",
     "Keyword3",
     "Keyword5",
     "Keyword6",
     "Keyword2",
     "Keyword4",
     null,
     "Keyword7",
     "Keyword8",
     "Keyword9"
    ]

     

    (3) Remove duplicates using the expression: 
    union(body('Select'),body('Select'))

    Snag_2619f369.png

    (4) Finally remove the null values using the Filter Array action:

    Snag_261c3a5c.png

    This is the output of the filter array action:

     

    Snag_26212f96.png


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

  • NewName896452 Profile Picture
    34 on at

    @ekarim2020 When I used the Initialize Variable (per your direction), I couldn't get it to work quite right so I decided to provide more context. 

    Overall Concept/Goal:
    We have a SharePoint library that we're using as a wiki library.  The SharePoint library list has "single line of text" columns that are designated for keywords about the topic of the wiki. The idea is if someone in a specific group MS Teams chat uses certain trigger words that seem like they're asking a question (know, how, where, what), the Automate flow will scan the body of their Teams message and compare it to the let of keywords. 

    If a common keyword is found, I want to create an adaptive card to respond to them in teams with a link to the suggested wiki. 

    Logistics of the Flow:
    So, an array of keywords originates from multiple columns from multiple items. I don't know enough about arrays to figure out how to merge the columns from the multiple items down into one clean array so it can be compared to the array that I successfully created from Teams. I'm sure I could be going about this entire process wrong, but I hope that helps with the data that I'm trying to convert and why.

     

    SharePoint Library (the source of keywords)

    1 - SharePoint_Source.png

    This shows the message in Teams at the top and how my end result looks by removing special characters and creating an array of those words in the message.

    2 - Teams_messages.png

    This is the flow itself if you want to look at it more closely. 

    3 - The_Entire_Flow.png

  • NewName896452 Profile Picture
    34 on at

    @ekarim2020 I've attached what the flow looks like when executed here. I hope all of this helps and isn't too much of a burden for you to help. Thank you for responding to this thread to begin with. I truly appreciate any help I can get. 

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard