cancel
Showing results for 
Search instead for 
Did you mean: 

Filter nested object based on NULL/EMPTY or not

rpc1235x
New Contributor II

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

rpc1235x_0-1712769794563.png

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

rpc1235x_1-1712769845327.png

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

rpc1235x_2-1712769892860.png

 

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

 

Thank you!

#Filter #Pipeline #FilterExpression

1 REPLY 1

Aleksandar_A
Contributor III

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.