IF node does not respect condition

The IF node does not respect the condition

The IF node is resulting in a True when it should be False

Information on your n8n setup

  • n8n version: 0.225.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system:

Hi @Rodolphe - welcome to the community :tada:

It looks like your properties field is an object, not an array, which is what isnotEmpty() would check. It’s only available for arrays, so this would actually be expected.

Does Object.keys($json.properties).length fix this up for you, by chance?

Thanks Grey, you are right!

But I have the same issue with the object key…

Had a test around with this @Rodolphe - looks like {{ Object.keys($json.stringify(obj)) }} and setting it to look for Empty will trigger it as as true branch / an empty object. You could also look for is not empty to trigger false, if that works better for how your workflow is set up… but it looks like that is appropriately looking to see if it’s empty or not.

Using your workflow you provided, this is triggering true under empty:

Might not be perfect, but might be a workaround for you?

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