Forum Discussion

rpc1235x's avatar
rpc1235x
New Contributor II
2 years ago

Filter nested object based on NULL/EMPTY or not

Hello,

I have a nested JSON object that I want to divide in two streams. Filtering based on if "account-allocations" is NULL/EMPTY or not. Both streams coming from the same pipeline and eventually merging. 

See example:

1) JSON OBJECT

2) WHEN YOU EXPAND THE FIRST ID, YOU CAN SEE THAT FOR THIS CASE "account-allocations" is empty

3) FOR THE SECOND ID, "account-allocations" is not empty (two nested entries in this case)

 

I tried the Filter snap, but couldn't make it work

 

Thank you!

#Filter #Pipeline #FilterExpression

1 Reply

  • Hello rpc1235x,

    You can use the Router Snap to divide the input stream into two separate streams based on the account-allocations field.

    My assumption is that we will always have the account-allocations field in the input, if not you can use the $.get("account-allocations") expression.

    Please refer to the attached pipeline and let me know if this helps you!

    Regards,

    Aleksandar.