Merge objects from 2 different nodes to 1 object for posting on http

Lets say I have an 2 objects (output of 2 different nodes) and need to send on the same object of an http post. Going crazy here with the expression builder to try and solve.
{{Object($node[“Set id”].json[“id”])}}
{{$node[“VTEX Payments”].json[“vtexpayments”]}}


Welcome to the community @pradilla!

If you actually want to merge two objects you can do the following:

{{ Object.assign({}, $node["Node1"].json, $node["Node2"].json) }}

in your case it however looks like you want a new object with one property of each. In this case it would be more something like this:

{{ {a: $node["Node1"].json.a, b: $node["Node2"].json.b, } }}

Using that as a blue-print and replacing with your node and variable names the following should work for you:

{{ {id: $node["Set id"], vtexpayments: $node["VTEX Payments"].json.vtexpayments, } }}

Thanks @jan !! Worked great! You can notice im not a developer, just enthusiast dev. I have used Integromat, love the easy it is but… n8n has proven to be very flexible! :slight_smile:

I had solved adding a function prior to the http call.

items[0] $node["VTEX Payments"].json["vtexpayments"]["paymentId"];
return items;

However being able to add in the expression seems a better way. Thanks for the example s provided.

PD: Expression and Function sections in docs.n8n should add all these type of examples so non-dev people can figure it out with more examples.

Thanks again

1 Like

Sounds about right. n8n does not strive to be the easiest solution on the market, we want to be the most powerful one instead.

That being said, we for sure still want to become much simpler than we are right now. So please bare with us. It will improve :wink:


Ah sorry missed the second part of your message. Yes such a section already exists. It is however totally new and still wip, so will grow over the next weeks. It can be found here: