Change values of 1 or 0 to anything else

Hi,

I need to send by email information received from a monitoring system.
An example of the information is below.

The issue i have is, sending values of 1 / 0 doesn’t mean much to people.
I would like to find a way in a simple way to change all values of 1 to be OK and all values 0 will be NOT OK

I found that i can do it with IF in Code node but this is for just one value… i have 30+ of them.

Does anyone know a more convenient way to do this?

Try this code node, the crux being

const myItem = $input.item.json;

for (let key in myItem) {
  if (myItem[key] == "1") {
    myItem[key]  = "OK"
  } else if (myItem[key] == "0") {
    myItem[key]  = "NOT OK"
  }
}

return $input.item;
3 Likes

Wow you are amazing!
I took it a step further and added emojis

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.