Map() function cannot combine two fields from the same array item

I am trying to map and join both firstName and lastName from a paxInfo array to produce a result like "Carlos Mendoza, Ana Mendoza, Sofia Mendoza" in one single expression.

My data structure:

"paxInfo": [
                            {
                                "firstName": "Klaudia",
                                "lastName": "Muster",
                                "gender": "Female",
                                "birthDate": "1972-01-27",
                                "age": 55,
                                "nationality": "Deutschland",
                                "nationalityCode": "DE",
                                "passportNr": "",
                                "isMainContact": true,
                                "loyaltyProgramMemberships": [],
                                "address": {},
                                "refId": "pax-1"
                            },
                            {
                                "firstName": "Alexander",
                                "lastName": "Muster",
                                "gender": "Male",
                                "birthDate": "1969-06-06",
                                "age": 57,
                                "nationality": "Deutschland",
                                "nationalityCode": "DE",
                                "passportNr": "",
                                "loyaltyProgramMemberships": [],
                                "refId": "pax-2"
                            }
                        ]

What works perfectly:

{{join(map(5.data.data.attributes.pax.paxInfo; "firstName"); ", ")}}
→ "Carlos, Ana, Sofia"

{{join(map(5.data.data.attributes.pax.paxInfo; "lastName"); ", ")}}
→ "Mendoza, Mendoza, Mendoza"

What I tried - all fail with the same error:

{{join(map(5.data.data.attributes.pax.paxInfo; item.firstName + " " + item.lastName); ", ")}}

{{join(map(5.data.data.attributes.pax.paxInfo; item["firstName"] + " " + item["lastName"]); ", ")}}

{{join(map(5.data.data.attributes.pax.paxInfo; get(item; "firstName") + " " + get(item; "lastName")); ", ")}}

Error received:

Failed to map 'field.Pasajeros': Function 'join' finished with error! 
Function 'map' finished with error! '{empty}' is not a valid key.

Current workaround:

{{join(map(5.data.data.attributes.pax.paxInfo; "firstName"); ", ") + " / " + join(map(5.data.data.attributes.pax.paxInfo; "lastName"); ", ")}}
→ "Carlos, Ana, Sofia / Mendoza, Mendoza, Mendoza"

This works but produces all firstnames and all lastnames after and not the desired firstName lastName per passenger format.

My question:
Is there any supported syntax in make.com to combine two fields from the same array item inside a map() function? A formular should include 1 or many passengers.

Thanks a lot!

Make’s ‘map()’ doesn’t support multi-field expressions. The second argument only accepts a single key string, all those attempts are throwing '{empty}’ because it is not a valid key.

The cleanest solution for this is an “Iterator and Aggregator” module combo instead of a formula. To do this:

  1. Add an “Iterator” on your paxInfo array
  2. Map {{item.firstName}} {{item.lastName}} as the text
  3. Feed into a “Text Aggregator” with , as the separator

That way you get Klaudia Muster, Alexander Muster without needing a whole formula.

Thanks @AnthonyatXRAY that worked perfectly!