Help converting string to key/value object

string split is probably best bet.

Split on <br> then loop the array and split on =

e.g...

image

const lines = msg.payload.split("<br>");
let result = {};

for (let i = 0; i < lines.length ; i++) {
    const line = lines[i].trim();
    if(!line) continue;
    let parts = line.split("=");
    if(parts.length != 2) continue;
    let key = parts[0].trim();
    let val = parts[1].trim();
    if(isNumeric(val)) val = Number(val)
    result[key] = val;
}

msg.payload = result;
return msg;

function isNumeric(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}