Is there a way to check if an object in a workflow payload is empty (has no child elements)

Have payload and want to check that {{data.channels}} contains no sub elements. Is there a handlebar to do that?

“data”: {
“channels”: {

I know how to check for null: {{data.channels}} != null.
Using in a conditional block.

1 Like

Can use {{length val}}

Yup, you got the right idea. {{length val}} will print out the number of keys if val points to an object.

In an expression, this would return true

{{length val}} === 0

And in a string template, you could conditionally render content like so …

{{#eq (length val) 0}}empty{{else}}not empty{{/eq}}