# IF node comparing 2 Objects

**URL:** <https://community.n8n.io/t/if-node-comparing-2-objects/15161>\
**Category:** Questions\
**Tags:** expressions, if\
**Created:** [June 24, 2022, 1:37pm UTC](https://community.n8n.io/t/if-node-comparing-2-objects/15161 "2022-06-24T13:37:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbesliu](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sbesliu](https://community.n8n.io/u/sbesliu)\
**Post date:** [June 24, 2022, 1:37pm UTC](https://community.n8n.io/t/if-node-comparing-2-objects/15161/1 "2022-06-24T13:37:48Z")

</div>

Hi all,

Im wondering if someone can give me a hand we currently trying to use the if node to compare an email address that comes from a webhook with a list of emails that comes from a HTTP request. When add the expression to use the values from the field it returns everything as false although there would be a true value. When i was testing before if i type in the value and compare it works as it should.

Any advice would be appreciated.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [June 24, 2022, 1:48pm UTC](https://community.n8n.io/t/if-node-comparing-2-objects/15161/2 "2022-06-24T13:48:16Z")

</div>

Hi @sbesliu, hope you are well?

This sounds like you might be missing a `$item(0).` in one of your expressions to make sure you’re always reading the first (and only) value from your webhook.

Check out this post for example for more details:

> [@"Set" losing value? Bug?](http://community.n8n.io/t/set-losing-value-bug/14969/3):
>
> Hi @xewonder, this is because your Set node returns only a single item, but subsequent nodes return multiple items. Now what would happen for an expression like {{ $node["Set"].json["insertId"] }} is that for the first item on your MySQL2 node, n8n would look up the first item on your Set node (which works). For the second item, n8n would look up the second item on your Set node which won’t work and so on. To avoid this, you would want to use an expression like {{ $item(0).$node["Set"].json["i…

---

<div class="post-metadata">

**Author:** ![sbesliu](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sbesliu](https://community.n8n.io/u/sbesliu)\
**Post date:** [June 24, 2022, 2:26pm UTC](https://community.n8n.io/t/if-node-comparing-2-objects/15161/3 "2022-06-24T14:26:05Z")

</div>

Worked like a charm and the explanation makes sense. Thank you so much.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [June 24, 2022, 2:27pm UTC](https://community.n8n.io/t/if-node-comparing-2-objects/15161/4 "2022-06-24T14:27:24Z")

</div>

Glad to hear, thanks so much for confirming!
