How to map a nested collection value in an array?

Hi community,

I’ve used the mapping function several times, but this time there is an array with nested collections. First I need to find the collection with “key = _dhl_services” and then map the value from “preferredLocation” in this result:

I was trying to work with this one, but it returns an empty value
{{map(23.metaData; "key"; "_dhl_services"; "value.preferredLocation")}}

Can someone please help adjust the formula properly?
Thanks :pray:

Hi @chaefner,

With the map() function, I remember this sentence:
“From this I want this, where this is this.”

Doesn’t make much sense, but it does to me. So from the top-level array, I want the value of this key, where this key has this value. Use the raw names of the keys and dot notation to access nested keys.

In this case:
{{map(23.metaData; "value.preferredLocation"; "key"; "_dhl_services")}}

Does this work for you?

Cheers,
Henk

2 Likes

Awesome @Henk-Operative . Thank you so much!

2 Likes