Payload parser fails to read an Array

Payload parser fails to read an Array

I wrote a code to parse the payload on my application (using the "Raw JSON to TagoJSON" snippet as base), written and tested in .js and it ran successfully. However, using the live inspector, I notice that TagoIO fails to interact with the array part (payload.data.measures) of my JSON payload. Im sure its something very minor, but I cant quite put my finger on it.

This is a sample input JSON that Im trying to parse:
  1. {
  2.     "info": {
  3.         "mac": "34:94:54:d1:f5:14",
  4.         "ssid": "GPRS MODE",
  5.         "rssi": 888,
  6.         "authmode": 888,
  7.         "version": "1.0.003"
  8.     },
  9.     "data": {
  10.         "measures": [
  11.             {
  12.                 "voltage": 213.9230194091797,
  13.                 "current": 5.131474018096924,
  14.                 "pf": 0.7040669322013855,
  15.                 "power": 772.93603515625
  16.             },
  17.             {
  18.                 "voltage": 213.06643676757812,
  19.                 "current": 5.749003887176514,
  20.                 "pf": 0.700843870639801,
  21.                 "power": 858.1580200195312
  22.             },
  23.             {
  24.                 "voltage": 213.7633056640625,
  25.                 "current": 5.165144443511963,
  26.                 "pf": 0.690386176109314,
  27.                 "power": 762.356201171875
  28.             }
  29.         ],
  30.         "offsets": [
  31.             -0.0000030675616926600924,
  32.             0.00002375497206230648,
  33.             -0.00026380849885754287,
  34.             -0.00003633246888057329,
  35.             0.00001980304114113096,
  36.             -0.000350890593836084
  37.         ],
  38.         "energy": [
  39.             154.7099609375,
  40.             170.38174438476562,
  41.             159.14356994628906
  42.         ]
  43.     }
  44. }

This is the code I ran on payload parser:
  1. const result = [];

    const devices_mac = { //tabela de macs dos medidores
      "34:94:54:d1:f5:14":"ufpe"
    };

    const unidades = { //tabela de unidades
      voltage:"V",
      current:"A",
      pf:"",
      power:"W"
    }

    for (const key in payload.data.measures[0]){
      const group = payload.data.measures[0].group || String(new Date().getTime());
      const unidade = unidades[key];
      device = devices_mac[payload.info.mac];

      result.push({
        variable: `${device}.${key}_faseA`,
        value: payload.data.measures[0][key].toFixed(2),
        unit: `${unidade}`,
        group: group

      });
     
    };

    for (const key in payload.data.measures[1]){
      const group = payload.data.measures[1].group || String(new Date().getTime());
      const unidade = unidades[key];
      device = devices_mac[payload.info.mac];

      result.push({
        variable: `${device}.${key}_faseB`,
        value: payload.data.measures[0][key].toFixed(2),
        unit: `${unidade}`,
        group: group

      });
     
    };

    for (const key in payload.data.measures[2]){
      const group = payload.data.measures[2].group || String(new Date().getTime());
      const unidade = unidades[key];
      device = devices_mac[payload.info.mac];

      result.push({
        variable: `${device}.${key}_faseC`,
        value: payload.data.measures[0][key].toFixed(2),
        unit: `${unidade}`,
        group: group

      });
     
    };

    payload[0] = result;
The error:


Expected result:


Sorry for being too long of a post. Thanks in advance.