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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

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

Users online (2,026)