Easier add/remove via an expression

Describe the issue/error/question

When you have an array that originates from a json for ex. and you want to remove a particular item from that array and add a different one. The current method is confusing and honestly made me just use a whole code node to do it. While on make.com it’s as simple as saying {{remove(add(1.labels; "Jolien"; "Thibault"); "Iedereen")}}
So in this example, the items ‘Jolien’ and ‘Thibault’ are being added to the labels array and ‘Iedereen’ is getting removed.

I’m just sharing this, because I think this could be a massive ease of use improvement area, in my opinion

Hopefully this will be coming in expression extensions. Would keep an eye on this refactor(core): Expression extensions shortlist (no-changelog) by ivov · Pull Request #5200 · n8n-io/n8n · GitHub

Might not be as straightforward with the first batch of extensions - n8n/ArrayExtensions.ts at fcc5758c7df60188f88d7f78e72478b7ce337b9b · n8n-io/n8n · GitHub

Could probably be done with a combination of difference, merge, and union but that wouldn’t be straightforward.

2 Likes