Inserting Data into existing JSON

Hi @aleks, welcome to the community :tada:

The merge node would merge individual items, but it seems your HTTP Request is already returning multiple items which you would like to treat as one item.

So, this will require a little bit of custom code I think. For example like so:

You can see that here I am first returning the template on my Mock template node. This would be the lower branch from your screenshot. I am then making an HTTP Request which would be the upper branch in your screenshot.

Lastly, I am running this bit of JS code:

const template = $('Mock template').first().json;

template.Data = $input.all().map(e => e.json);

return [{
  json: template
}];

This code reads the first (and only) element from the Mock template node.

It then puts all the incoming items under the Data key of your template and removes their json key. This key is used by n8n to distinguish different data types, but you most likely don’t want that in your output data.

It then returns the result.

Hope this helps! Let me know if you have any questions on this :slight_smile: