Quite a lot IoT devices send multiple values, addresses, information etc in one message object.
I have some cases where the elements later on start interfering with other functions since namespaces etc. are overlapping.
Today I'm solving this with a simple function node along the line of:
temp = msg.KeepThis
msg = {};
msg.payload = temp;
return msg;
Usually I would prefer to use the change
node but deleting unwanted parts of a msg object is quite cumbersome on larger objects.
I wanted to ask if there is a best practice or if the change
node could be enhanced to allow more flexible ways of cleaning out unwanted data, like:
- "Keep only" / "Delete all but"
- "Protect KeepThis" + "Delete all"
- Regex delete with look-ahead, look-behind