array join in n8n not working correctly.
I have used it before, but in the latest version it is not working properly
Can’t change separator
Information on your n8n setup
n8n version: 0.168.2
Database you’re using: mysql
Running n8n with the execution process [own(default), main]: default
Running n8n via: Docker
Hi @macosupdate, welcome to the community! I am very sorry to hear you’re having trouble here. I quickly tried this on my end but was unable to reproduce this unfortunately:
The separator shows up as expected.
Is there a chance this is a browser-specific problem? Does the join work correctly if you actually execute the node?
Hey @macosupdate, thanks so much for the example workflow you have provided, this makes it much clearer what is going on here!
It seems your example array only has a single value (which includes the comma). So .join() would simply return that single value because there are no additional values to join.
This is because on the website you are fetching data from, there is only a single object matching your CSS selector, so the Return Array option on your HTML extract node would simply wrap that single value inside an array:
I’ve added a Function Item node to your workflow which splits up the single string into individual array values on the comma and removes whitespaces. You can then use .join() to join it again into a string using any separator you like:
This is how the result would look like:
I have not checked again. So sorry. It is not an array. I just need to change the css selector to .genres-content a, no need to use function item. Thank you very much
Glad to hear you got it working, many thanks for confirming