Filter out data

Hi.

Have a change node that changes from NL1 to a Json string.
That works fine but I want to remove everything else and just let the json pass.

Any idea how I can accomplish this?

Hi - what do you mean by "want to remove everything else"? Do you mean you want to remove all of the other msg properties and just leave msg.payload ?

Or do you mean you only want to let particular messages through, in which case you can use a Switch node. If you can't see how to do that then tell us what it is that distinguishes messages you want to pass from those you want to filter out.

I'll have a guess too

Do you mean only pass a msg with your JSON and nothing else?

If so, one way could be to use a function node with the following code...

return { payload: msg.payload }

Just want {SecuritySystemCurrentState: 2} nothing else in the debug

You can indeed filter out properties in the debug node. The first way is hard code the specific property to want to display, for instance :

r-01

Another possible approach is using a jsonata expression.

Yeah the op is as clear as mud. I suspect he wants the filtering (only send what he's interested in) to be passed from node to node. The mention of debug was likely cos that's where he views it? I may be wrong but the op is barely making any effort to be explicit.

Indeed, I replied without being sure what is the requirement. Block something or let something else pass

If you truly mean the only thing you want to see in the debug output then click the filter button above the debug pain labeled "all nodes" and change it to "selected nodes" and only tick the one you want.

1 Like

offtopic: Those 50 http request nodes can be replaced by one and use msg.url to form the url.

Lol I was gonna say something similar but thought it might open a can of worms. Yes. Some serious simplification could be done me thinks.

1 Like