Best way to combine dissimilar array items into a single array?

Describe the issue/error/question

I have two arrays of items. One array is of a list of user created posts coming from the app Im building, the other array is a list of YouTube videos being searched for against the YouTube API. I need to combine these into a single array but am not sure the best way to do this with Javascript.
I share the workflow below, don’t worry I will reset all the keys once I get it going.

Please share the workflow

Share the output returned by the last node

The last node just returns YouTube videos like the YouTube API would, but I would like for the all Adalo posts to also contains these YouTube videos as array items, even if the keys are not all filled.

Information on your n8n setup

  • n8n version: 0.173.1
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm,, desktop app]: Docker

Hi @pford

Not completely sure what you want to do here.
Do you want to add the posts to the youtube video’s? So for example a video has an array of posts that are connected to it?

Thanks for your response. I’d like to make each YouTube video a separate item in the first array (All Adalo Posts). I thought about constructing a custom JSON structure with only the fields that I need, but still not quite sure how to combine the two arrays.

Sorry, not completely sure still.
So you just want to concatenate the 2 arrays?
You can use the merge node for that with the append option. All possible fields will exist then, some of them will be empty for half the records if it exists in only 1 of the 2 arrays. So it would be smart to rename fields that are the same so they get the same fieldname and not have duplicate fieldnames that are basically the same thing. And of course make sure to only keep the fields you need.