[SOLVED] Convert Array to String

A node on one of my flows outputs an array containing entity_id’s for Sono’s speakers active on my network. THis array is then passed to a function node where I wish to convert it to a string. I want to convert the array to a string. I’ve been working on this for some time without success. The array looks like this;

sonos_speaker_list_entity_id: array[4]
0: "media_player.kitchen_sonos"
1: "media_player.breakfast_sonos"
2: "media_player.workshop_sonos"
3: "media_player.livingroom_sonos"

Please let me know how I go about converting the array to a string that looks like;

media_player.kitchen_sonos,media_player.breakfast_sonos,media_player.workshop_sonos,media_player.livingroom_sonos

const joinedArray = sonos_speaker_list_entity_id.join(",");

I believe the join node also works. But if you’re doing things in the function node anyways then use that.

@Kermit , prompt and precise, as usual. Thank you.

I looked at the join node but was unsure how to configure it. I’m building my skills and would like to know what the approach would be. Would you mind sharing?

Appreciate

I have to say I’m defeated.
I can’t do it with the join node, I thought it was possible.

Split node can break up arrays into individual messages.

yes, you can use a change node to make msg.sonos_speaker_list_entity_id => msg.payload.
Then split node to make each sonos a new message, then join them.

But that is too much of a hassle. I was expecting just the join node to be able to join arrays also and not just messages.

Perhaps there is a custom node that can do it.