Help to filter data

Hi,

I try to create function which filters data out based on values.

I only need values where visible is true. I've been banging my head against wall now 2 days for this.
If there is better way to do this than function, it would be nice to hear it.

Thank you very much, for help.

Br,

Ville

Assuming that this array of objects is in msg.payload then a simple Javascript function would work:

msg.payload = msg.payload.filter(o => o.visible);
return msg;

Since you said you don't want to use the function node, I would tend to use a change node with this JSONata expression:

payload[visible=true]

Actually, I was surprised to see that there is no built-in core node called filter or some such thing... I thought there was one. Did I just miss it?

Try using change node and JSONata

payload[visible=true]

[edit] i see @shrickus already suggested it.

Thank you, now I got it working.

Br,

Ville