Expression to skip null values in Set block

Describe the issue/error/question

I have an export of a Slack workspace’s users. Some users don’t have an email for whatever reason (it doesn’t matter for my use case). I currently use

{{ $json["profile"]["email"] ? $json["profile"]["email"] : null }}

in a Set block to grab just the emails. This will litter my output with various nulls I then have to remove later somehow.

Is there a way to tweak how I’m gathering the emails with this expression to just skip nulls all in one node?

Running with just the property ({{ $json["profile"]["email"] }} still seems to write out a blank/undefined json object.

Hi @ianhyzy

You want to reduce the number of items passing through the flow?
Then you can only do this with an IF node after this set for example.
Or by creating a new itemlist with the code node.
something like this:

// Loop over input items and add a new field
// called 'myNewField' to the JSON of each one
const newItems = [];
for (const item of $input.all()) {
  if(!== undefined){

return newItems;
1 Like

I was trying to remove any null values and not pass them on without another node yes, I’ll give this a shot - thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.