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.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,551)