IF node: Having issues with "contains" conditional

Hi,
I’ve a very simple IF node. The value of t1 is set as "IOC Test". But when I try to do a conditonal using “Contains” it is not finding it. It comes correctly in the “false” output, but I expected it to be in True


name	"if_test"
nodes	
0	
parameters	{}
name	"Start"
type	"n8n-nodes-base.start"
typeVersion	1
position	
0	240
1	300
1	
parameters	
values	
string	
0	
name	"t1"
value	"\"IOC test\""
options	{}
name	"Set"
type	"n8n-nodes-base.set"
typeVersion	1
position	
0	460
1	300
2	
parameters	
conditions	
string	
0	
value1	"t1"
operation	"contains"
value2	"IOC"
name	"IF"
type	"n8n-nodes-base.if"
typeVersion	1
position	
0	680
1	300
connections	
Start	
main	
0	
0	
node	"Set"
type	"main"
index	0
Set	
main	
0	
0	
node	"IF"
type	"main"
index	0
active	false
settings	{}
id	7

Instead of string “t1” you want to put their variable $JSON['t1']
Check this workflow:

Or this GIF how to do this: Imgur: The magic of the Internet

You mean to say

={{$json[\"t1\"]}}

Yes, :grinning:

Just follow GIF, I think it easier way than rewriting this.

Is it work?

1 Like

It actually has to be:

{{$json["t1"]}}

Else it would be an invalid expression.

3 Likes

thanks guys, it worked