get an object in an array based on it's property
Options
![Thierry MARTIN](https://us.v-cdn.net/6037124/user_avatars/2208966.jpg)
Thierry MARTIN
Member ✭
Hello,
I'm parsing a "product" object (json) that contains a property "images" which is an array of objects.
{
...,
images:[
{
type:"primary",
width:600,
uri:"xxx"
},
{
...
}
],
...
}
I'd like to get the uri property of the image that has the type property set to "primary", but i can't figure out how to do that.
There are several filters available on product.images, but none of them seems to let me filter the array according to a property of the objects it contains...
I'm parsing a "product" object (json) that contains a property "images" which is an array of objects.
{
...,
images:[
{
type:"primary",
width:600,
uri:"xxx"
},
{
...
}
],
...
}
I'd like to get the uri property of the image that has the type property set to "primary", but i can't figure out how to do that.
There are several filters available on product.images, but none of them seems to let me filter the array according to a property of the objects it contains...
Comments
-
I would use the function Array: Find First Element
Use the images [] array as the array
Then set $this.type = primary
This will return the object that is type primary, from there you can use dot notation to isolate and return the URI
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback