How to leave only those "key": "value" pairs that are not equal to the given value?

Hey!
As to leave only those “key”: “value” pairs that are not equal to the given value, in this case, you need to leave everything except “uuid”.

Hey @Roket!

Not sure what exactly you want to do. Do you want to just return the “uuid” after a condition is satisfied? If yes, you can use the Set node. Make sure to toggle the Keep Only Set to true.

Instead, everything needs to be returned except “uuid”.

In general, I see the task more broadly.
You need to configure the functional node so that you can add keys there, which you do not need to transfer further.

Are there any options for solving the problem?

You can do it with a Function-Node and code like this:

const deleteKeys = ['uuid'];
items.forEach(item => {
  deleteKeys.forEach(key => {
    if (item.json[key]) delete item.json[key];
  });
});
return items;

Probably not the most efficient code but works.

1 Like

Jan, thanks a lot!
How to apply this script for several keys at the same time?

You can add the keys that you want to delete to the deleteKeys array. For example, if you want to delete the uuid and status you can use const deleteKeys = ['uuid', 'status']; instead of const deleteKeys = ['uuid'];

1 Like

harshil1712, thanks!