Ifempty in expression

That definitely works but you can simplify it to:
{{ $json.set2 ? $json.set2 : $json.code }}
or simply it even further with {{ $json.set2 || $json.code }}.

If the code I quoted worked for you then so will both of these if you just copy and paste them. Read more about it by looking up truthy and falsy values, ternary operation, and logical or operator (||)

The $json.set2 ? will automatically return false if it is undefined or “”, so you only need to put the value itself in this case

2 Likes