cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cassio_milanelo
Frequent Visitor

Create array of single attribute from array of objects without looping

I'm trying to go from this:

 

{
  "fruits": [
    {
      "name": "Apple",
      "price": 35
    },
    {
      "name": "Banana",
      "price": 12
    },
    {
      "name": "Grapes",
      "price": 45
    },
    {
      "name": "Pineapple",
      "price": 200
    }
  ]
}

 

 

To this:

 

[ "Apple", "Banana", "Grapes", "Pineapple" ]

 

 

Without looping through the first array. Any ideas on how to do that? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

Like this:

2021-04-14_13-36-40.png

Create a select action. Put it into text mode. Expression for from is:

outputs('Compose')['fruits']

expression for map is:

item()['name']

output is:

[
  "Apple",
  "Banana",
  "Grapes",
  "Pineapple"
]

View solution in original post

2 REPLIES 2
Paulie78
Super User
Super User

Like this:

2021-04-14_13-36-40.png

Create a select action. Put it into text mode. Expression for from is:

outputs('Compose')['fruits']

expression for map is:

item()['name']

output is:

[
  "Apple",
  "Banana",
  "Grapes",
  "Pineapple"
]
cassio_milanelo
Frequent Visitor

That's exactly what I needed @Paulie78!

Thank you a million!

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Users online (3,162)