Append data to array elements with merge node

Hello there, first of all: Thanks for your great support right here.

Coming to my question: In my workflow I have an array of Portfolios, of which each holds an array of assets. I also have a list of assets with their properties (of which some are an array as well).

How can I merge these two data sets in a way that the assets in the Portfolio list are enriched with the asset details?

Here is some mock data:

Many thanks in advance!!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Welcome to the community @CGNM91 !

The below workflow seems to do what you are looking for. I purposefully avoided using Code node and sticked to no-code solution.

Hi @CGNM91 ,

while I agree with @ihortom that the code node can be avoided (it’s a bit heavier in terms of processing and may slow down your performance if you have a large data set), I played around with it to achieve your desired outcome.

Plus, this was a nice coding exercise :blush:

Note: The code node is not designed to have two inputs, so I needed to use an additional merge node to provide the input as one.

1 Like