Working with JSON data objects coming from MQTT

Hi,

My first time on this forum. Working with incoming MQTT Data. It is a big JSON string. Tried outputting it both as string/buffer as well as parsed JSON object.

What im trying to do here is extract the individual key value pairs in variables. However, I think because of the structure of my JSON file, it does not work well in NodeRed and I cannot get my key value pairs. All I see is either 'undefined' error or something like cannot read property value, something like this.

I think its because of all the objects and subobjects that I have.

[
    {
        "id": "b190f6b08d42b688",
        "type": "tab",
        "label": "Flow 4",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "092150cb0ed54125",
        "type": "mqtt in",
        "z": "b190f6b08d42b688",
        "name": "MQTT_ATM",
        "topic": "/Krohne assemblage ATM flowmeter/production/product/#",
        "qos": "0",
        "datatype": "json",
        "broker": "7f92728b10ba1af4",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 390,
        "y": 160,
        "wires": [
            [
                "54405b338d7e31e4",
                "779becb8197b1398"
            ]
        ]
    },
    {
        "id": "54405b338d7e31e4",
        "type": "debug",
        "z": "b190f6b08d42b688",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 590,
        "y": 160,
        "wires": []
    },
    {
        "id": "779becb8197b1398",
        "type": "function",
        "z": "b190f6b08d42b688",
        "name": "",
        "func": "var raw_data=msg.payload;\n//var temp=JSON.parse(msg.payload);\n//var product=raw_data.product;\nvar dummy = \"->\";\nvar articleCode=raw_data.articleCode;\n//var revision=temp.revision;\n//var solderTime=temp.solderTime;\nvar msg1={};\nstringy=\"+articleCode+\";\nmsg1.payload=raw_data;\nreturn msg1;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 240,
        "wires": [
            [
                "87865c0b7d7e9021"
            ]
        ]
    },
    {
        "id": "87865c0b7d7e9021",
        "type": "debug",
        "z": "b190f6b08d42b688",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 240,
        "wires": []
    },
    {
        "id": "7f92728b10ba1af4",
        "type": "mqtt-broker",
        "name": "ATM Machine",
        "broker": "10.51.171.10",
        "port": "1883",
        "clientid": "node-red",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

Here is my flow. I just trying to parse it first.

{
  "->": {
    "product": {
      "value": "ATM"
    },
    "articleCode": {
      "value": "4006110802"
    },
    "revision": {
      "value": "003"
    },
    "recipe": {
      "value": "4006110802 ATM DN25 EPDM"
    },
    "recipeRevision": {
      "value": "003"
    },
    "serialNumber": {
      "value": "22811845"
    },
    "orderNumber": {
      "value": "dn25epdm29-08-2022"
    },
    "labelCode": {
      "value": "4006110802_003_22811845_X"
    },
    "readCode": {
      "value": "4006110802_003_22811845_X"
    },
    "status": {
      "value": 20
    },
    "solderingStation": {
      "value": 0.35,
      "->": {
        "solderTime": {
          "value": 4000
        },
        "cooldownTime": {
          "value": 2000
        },
        "power": {
          "value": 99
        }
      }
    },
    "weld": {
      "value": 10,
      "->": {
        "rotatorStartPosition": {
          "value": 4
        },
        "rotatorDegToWeld": {
          "value": -7
        },
        "rotatorWeldSpeed": {
          "value": 31.8
        },
        "laserPowerWatt": {
          "value": 600
        },
        "laserStartDelay": {
          "value": 10
        },
        "clampPressure": {
          "value": 2.5
        }
      }
    },
    "testResult": {
      "value": 2
    },
    "pressurize": {
      "value": 6,
      "->": {
        "setPressure": {
          "value": 24
        },
        "allowedError": {
          "value": 5
        },
        "stabilisationTime": {
          "value": 1000
        },
        "isolationTime": {
          "value": 15000
        },
        "flowTime": {
          "value": 10000
        },
        "maxTime": {
          "value": 5000
        },
        "returnCode": {
          "value": 2
        },
        "isolatedPressure": {
          "value": 23.908068
        }
      }
    },
    "pressureDropTest": {
      "value": 6,
      "->": {
        "testTime": {
          "value": 30000
        },
        "allowedStartError": {
          "value": 5
        },
        "setTestPressure": {
          "value": 24
        },
        "allowedDrop": {
          "value": 2.5
        },
        "returnCode": {
          "value": 2
        },
        "startPressure": {
          "value": 23.908059
        },
        "endPressure": {
          "value": 23.585986
        },
        "testResult": {
          "value": 2
        }
      }
    },
    "impedanceTest": {
      "value": 0.381478,
      "->": {
        "frequencies": {
          "value": "[20.000,2000.000]"
        },
        "voltageLevel": {
          "value": 0.1
        },
        "minImpedances": {
          "value": "[3000.000,0.000]"
        },
        "maxImpedances": {
          "value": "[25000.000,100000.000]"
        },
        "minPhaseAngle": {
          "value": "[-90.000,-10.000]"
        },
        "maxPhaseAngle": {
          "value": "[0.000,0.000]"
        },
        "requiredSerialNumber": {
          "value": ""
        },
        "returnCode": {
          "value": 2
        },
        "testResult": {
          "value": 2
        },
        "leftImpedances": {
          "value": "[14008.500,5167.019]"
        },
        "leftPhaseAngle": {
          "value": "[-44.278,-6.764]"
        },
        "rightImpedances": {
          "value": "[14705.699,5804.699]"
        },
        "rightPhaseAngle": {
          "value": "[-40.778,-6.814]"
        },
        "actualSerialNumber": {
          "value": "GER880566"
        }
      }
    },
    "zeroFlowTest": {
      "value": 0.35,
      "->": {
        "numberOfSamples": {
          "value": 50
        },
        "ticksPerSample": {
          "value": 25
        },
        "dutSerialNumber": {
          "value": "TESTATM01"
        },
        "minDutStdDev": {
          "value": 0
        },
        "maxDutStdDev": {
          "value": 0.008
        },
        "minDutAverage": {
          "value": -0.002
        },
        "maxDutAverage": {
          "value": 0.002
        },
        "returnCode": {
          "value": 2
        },
        "testResult": {
          "value": 2
        },
        "dutSensorStatus": {
          "value": 100512
        },
        "standardDeviationDut": {
          "value": 0.00166
        },
        "runningAverageDut": {
          "value": -0.000326
        },
        "flowSource": {
          "value": "ATMObj1200"
        },
        "samplesTaken": {
          "value": 50
        },
        "sampleTime": {
          "value": 12860
        },
        "refSensorStatus": {
          "value": 0
        }
      }
    },
    "setFlow": {
      "value": 24,
      "->": {
        "stabilisationTime": {
          "value": 8000
        }
      }
    },
    "flowTest": {
      "value": 30000,
      "->": {
        "numberOfSamples": {
          "value": 50
        },
        "ticksPerSample": {
          "value": 25
        },
        "dutSerialNumber": {
          "value": "TESTATM01"
        },
        "refSerialNumber": {
          "value": "20180612_30"
        },
        "minDutAverageDeviation": {
          "value": -15
        },
        "maxDutAverageDeviation": {
          "value": 10
        },
        "minRefAverage": {
          "value": 0.35
        },
        "maxRefAverage": {
          "value": 0.45
        },
        "minDutStdDev": {
          "value": 0.0001
        },
        "maxDutStdDev": {
          "value": 0.02
        },
        "minRefStdDev": {
          "value": 0.0001
        },
        "maxRefStdDev": {
          "value": 0.01
        },
        "maxDutTemperature": {
          "value": 999999999999.9
        },
        "minDutTemperature": {
          "value": -999999999999.9
        },
        "sizeFactor": {
          "value": 4.469
        },
        "returnCode": {
          "value": 2
        },
        "testResult": {
          "value": 2
        },
        "standardDeviationDut": {
          "value": 0.008271
        },
        "standardDeviationRef": {
          "value": 0.002798
        },
        "temperatureDut": {
          "value": -55
        },
        "temperatureRef": {
          "value": 27.447506
        },
        "runningAverageDut": {
          "value": 0.38066
        },
        "runningAverageRef": {
          "value": 0.41175
        },
        "sampleTime": {
          "value": 16380
        },
        "flowSource": {
          "value": "ATMObj1200"
        },
        "samplesTaken": {
          "value": 50
        }
      }
    },
    "prevSerialNumber": {
      "value": "22811844"
    },
    "dataTimeStamp": {
      "value": "2022-08-29T08:07:52.738Z"
    }
  },
  "/": {
    "coil": {
      "->": {
        "product": {
          "value": "Coil"
        },
        "articleCode": {
          "value": "4008043701"
        },
        "revision": {
          "value": "000"
        },
        "status": {
          "value": 4
        },
        "readCode": {
          "value": "4008043701 000 2108 24284 62@ 1600"
        },
        "measuredTrayPosition": {
          "value": "[15949.899,6470.490]",
          "->": {
            "x": {
              "value": 189
            },
            "y": {
              "value": 36.5
            },
            "z": {
              "value": 55
            }
          }
        },
        "trayDelta": {
          "value": 2,
          "->": {
            "x": {
              "value": 1.164398
            },
            "y": {
              "value": -2.17178
            },
            "rz": {
              "value": -0.148381
            }
          }
        }
      },
      "/": {
        "uBracket": {
          "->": {
            "product": {
              "value": "Ubracket"
            },
            "status": {
              "value": 1
            }
          }
        }
      }
    },
    "eCable": {
      "->": {
        "product": {
          "value": "Ecable"
        },
        "status": {
          "value": 2
        },
        "number": {
          "value": 27
        }
      }
    },
    "tube": {
      "->": {
        "articleCode": {
          "value": "4005945302"
        },
        "status": {
          "value": 6
        },
        "product": {
          "value": "Tube"
        },
        "trayCode": {
          "value": "04447 4005945302 003"
        },
        "cmdDispense1": {
          "value": "003",
          "->": {
            "dispenseTime": {
              "value": 50
            },
            "pressureSetPoint": {
              "value": 4.1
            }
          }
        },
        "cmdDispense2": {
          "value": 50,
          "->": {
            "dispenseTime": {
              "value": 50
            },
            "pressureSetPoint": {
              "value": 4.1
            }
          }
        }
      }
    }
  }
}

Here is my JSON file.

Thanks in advance!

Thanks for posting a simple flow and a sample message, and in a format we can import. A rare achievement for a first post! :grinning:

In the snippet you have posted you are trying to access raw_data.articleCode (raw_data = msg.payload)
but in your sample data articleCode is msg.payload["->"].articleCode or raw_data["->"].articleCode

I am puzzled by the elements of msg.payload. The keys "->" and "/" are either the result of a mistake or just cryptic.

ps the declaration of [unused] stringy="+articleCode+"; should be declared as const, let or var.

1 Like

You could try cleaning up the json.
this should return a cleaner object with key value arrays if sub objects e.g.

[{"id":"24427013.9c83a","type":"change","z":"30af2d3e.d94ea2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$spread($merge($$.payload.*)).${$keys($): [$.*.*]}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1380,"wires":[["2dfdae9e.4eab8a"]]},{"id":"71dd4efc.1f64a","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"->\":{\"product\":{\"value\":\"ATM\"},\"articleCode\":{\"value\":\"4006110802\"},\"revision\":{\"value\":\"003\"},\"recipe\":{\"value\":\"4006110802 ATM DN25 EPDM\"},\"recipeRevision\":{\"value\":\"003\"},\"serialNumber\":{\"value\":\"22811845\"},\"orderNumber\":{\"value\":\"dn25epdm29-08-2022\"},\"labelCode\":{\"value\":\"4006110802_003_22811845_X\"},\"readCode\":{\"value\":\"4006110802_003_22811845_X\"},\"status\":{\"value\":20},\"solderingStation\":{\"value\":0.35,\"->\":{\"solderTime\":{\"value\":4000},\"cooldownTime\":{\"value\":2000},\"power\":{\"value\":99}}},\"weld\":{\"value\":10,\"->\":{\"rotatorStartPosition\":{\"value\":4},\"rotatorDegToWeld\":{\"value\":-7},\"rotatorWeldSpeed\":{\"value\":31.8},\"laserPowerWatt\":{\"value\":600},\"laserStartDelay\":{\"value\":10},\"clampPressure\":{\"value\":2.5}}},\"testResult\":{\"value\":2},\"pressurize\":{\"value\":6,\"->\":{\"setPressure\":{\"value\":24},\"allowedError\":{\"value\":5},\"stabilisationTime\":{\"value\":1000},\"isolationTime\":{\"value\":15000},\"flowTime\":{\"value\":10000},\"maxTime\":{\"value\":5000},\"returnCode\":{\"value\":2},\"isolatedPressure\":{\"value\":23.908068}}},\"pressureDropTest\":{\"value\":6,\"->\":{\"testTime\":{\"value\":30000},\"allowedStartError\":{\"value\":5},\"setTestPressure\":{\"value\":24},\"allowedDrop\":{\"value\":2.5},\"returnCode\":{\"value\":2},\"startPressure\":{\"value\":23.908059},\"endPressure\":{\"value\":23.585986},\"testResult\":{\"value\":2}}},\"impedanceTest\":{\"value\":0.381478,\"->\":{\"frequencies\":{\"value\":\"[20.000,2000.000]\"},\"voltageLevel\":{\"value\":0.1},\"minImpedances\":{\"value\":\"[3000.000,0.000]\"},\"maxImpedances\":{\"value\":\"[25000.000,100000.000]\"},\"minPhaseAngle\":{\"value\":\"[-90.000,-10.000]\"},\"maxPhaseAngle\":{\"value\":\"[0.000,0.000]\"},\"requiredSerialNumber\":{\"value\":\"\"},\"returnCode\":{\"value\":2},\"testResult\":{\"value\":2},\"leftImpedances\":{\"value\":\"[14008.500,5167.019]\"},\"leftPhaseAngle\":{\"value\":\"[-44.278,-6.764]\"},\"rightImpedances\":{\"value\":\"[14705.699,5804.699]\"},\"rightPhaseAngle\":{\"value\":\"[-40.778,-6.814]\"},\"actualSerialNumber\":{\"value\":\"GER880566\"}}},\"zeroFlowTest\":{\"value\":0.35,\"->\":{\"numberOfSamples\":{\"value\":50},\"ticksPerSample\":{\"value\":25},\"dutSerialNumber\":{\"value\":\"TESTATM01\"},\"minDutStdDev\":{\"value\":0},\"maxDutStdDev\":{\"value\":0.008},\"minDutAverage\":{\"value\":-0.002},\"maxDutAverage\":{\"value\":0.002},\"returnCode\":{\"value\":2},\"testResult\":{\"value\":2},\"dutSensorStatus\":{\"value\":100512},\"standardDeviationDut\":{\"value\":0.00166},\"runningAverageDut\":{\"value\":-0.000326},\"flowSource\":{\"value\":\"ATMObj1200\"},\"samplesTaken\":{\"value\":50},\"sampleTime\":{\"value\":12860},\"refSensorStatus\":{\"value\":0}}},\"setFlow\":{\"value\":24,\"->\":{\"stabilisationTime\":{\"value\":8000}}},\"flowTest\":{\"value\":30000,\"->\":{\"numberOfSamples\":{\"value\":50},\"ticksPerSample\":{\"value\":25},\"dutSerialNumber\":{\"value\":\"TESTATM01\"},\"refSerialNumber\":{\"value\":\"20180612_30\"},\"minDutAverageDeviation\":{\"value\":-15},\"maxDutAverageDeviation\":{\"value\":10},\"minRefAverage\":{\"value\":0.35},\"maxRefAverage\":{\"value\":0.45},\"minDutStdDev\":{\"value\":0.0001},\"maxDutStdDev\":{\"value\":0.02},\"minRefStdDev\":{\"value\":0.0001},\"maxRefStdDev\":{\"value\":0.01},\"maxDutTemperature\":{\"value\":999999999999.9},\"minDutTemperature\":{\"value\":-999999999999.9},\"sizeFactor\":{\"value\":4.469},\"returnCode\":{\"value\":2},\"testResult\":{\"value\":2},\"standardDeviationDut\":{\"value\":0.008271},\"standardDeviationRef\":{\"value\":0.002798},\"temperatureDut\":{\"value\":-55},\"temperatureRef\":{\"value\":27.447506},\"runningAverageDut\":{\"value\":0.38066},\"runningAverageRef\":{\"value\":0.41175},\"sampleTime\":{\"value\":16380},\"flowSource\":{\"value\":\"ATMObj1200\"},\"samplesTaken\":{\"value\":50}}},\"prevSerialNumber\":{\"value\":\"22811844\"},\"dataTimeStamp\":{\"value\":\"2022-08-29T08:07:52.738Z\"}},\"/\":{\"coil\":{\"->\":{\"product\":{\"value\":\"Coil\"},\"articleCode\":{\"value\":\"4008043701\"},\"revision\":{\"value\":\"000\"},\"status\":{\"value\":4},\"readCode\":{\"value\":\"4008043701 000 2108 24284 62@ 1600\"},\"measuredTrayPosition\":{\"value\":\"[15949.899,6470.490]\",\"->\":{\"x\":{\"value\":189},\"y\":{\"value\":36.5},\"z\":{\"value\":55}}},\"trayDelta\":{\"value\":2,\"->\":{\"x\":{\"value\":1.164398},\"y\":{\"value\":-2.17178},\"rz\":{\"value\":-0.148381}}}},\"/\":{\"uBracket\":{\"->\":{\"product\":{\"value\":\"Ubracket\"},\"status\":{\"value\":1}}}}},\"eCable\":{\"->\":{\"product\":{\"value\":\"Ecable\"},\"status\":{\"value\":2},\"number\":{\"value\":27}}},\"tube\":{\"->\":{\"articleCode\":{\"value\":\"4005945302\"},\"status\":{\"value\":6},\"product\":{\"value\":\"Tube\"},\"trayCode\":{\"value\":\"04447 4005945302 003\"},\"cmdDispense1\":{\"value\":\"003\",\"->\":{\"dispenseTime\":{\"value\":50},\"pressureSetPoint\":{\"value\":4.1}}},\"cmdDispense2\":{\"value\":50,\"->\":{\"dispenseTime\":{\"value\":50},\"pressureSetPoint\":{\"value\":4.1}}}}}}}","payloadType":"json","x":120,"y":1420,"wires":[["24427013.9c83a"]]},{"id":"2dfdae9e.4eab8a","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":1160,"wires":[]}]

so values would be at msg.payload.product[0] and extras if any would be at index[1]
e.g soldering time would be
msg.solderingStation[1].solderTime.value

output

{
    "product": [
        "ATM"
    ],
    "articleCode": [
        "4006110802"
    ],
    "revision": [
        "003"
    ],
    "recipe": [
        "4006110802 ATM DN25 EPDM"
    ],
    "recipeRevision": [
        "003"
    ],
    "serialNumber": [
        "22811845"
    ],
    "orderNumber": [
        "dn25epdm29-08-2022"
    ],
    "labelCode": [
        "4006110802_003_22811845_X"
    ],
    "readCode": [
        "4006110802_003_22811845_X"
    ],
    "status": [
        20
    ],
    "solderingStation": [
        0.35,
        {
            "solderTime": {
                "value": 4000
            },
            "cooldownTime": {
                "value": 2000
            },
            "power": {
                "value": 99
            }
        }
    ],
    "weld": [
        10,
        {
            "rotatorStartPosition": {
                "value": 4
            },
            "rotatorDegToWeld": {
                "value": -7
            },
            "rotatorWeldSpeed": {
                "value": 31.8
            },
            "laserPowerWatt": {
                "value": 600
            },
            "laserStartDelay": {
                "value": 10
            },
            "clampPressure": {
                "value": 2.5
            }
        }
    ],
    "testResult": [
        2
    ],
    "pressurize": [
        6,
        {
            "setPressure": {
                "value": 24
            },
            "allowedError": {
                "value": 5
            },
            "stabilisationTime": {
                "value": 1000
            },
            "isolationTime": {
                "value": 15000
            },
            "flowTime": {
                "value": 10000
            },
            "maxTime": {
                "value": 5000
            },
            "returnCode": {
                "value": 2
            },
            "isolatedPressure": {
                "value": 23.908068
            }
        }
    ],
    "pressureDropTest": [
        6,
        {
            "testTime": {
                "value": 30000
            },
            "allowedStartError": {
                "value": 5
            },
            "setTestPressure": {
                "value": 24
            },
            "allowedDrop": {
                "value": 2.5
            },
            "returnCode": {
                "value": 2
            },
            "startPressure": {
                "value": 23.908059
            },
            "endPressure": {
                "value": 23.585986
            },
            "testResult": {
                "value": 2
            }
        }
    ],
    "impedanceTest": [
        0.381478,
        {
            "frequencies": {
                "value": "[20.000,2000.000]"
            },
            "voltageLevel": {
                "value": 0.1
            },
            "minImpedances": {
                "value": "[3000.000,0.000]"
            },
            "maxImpedances": {
                "value": "[25000.000,100000.000]"
            },
            "minPhaseAngle": {
                "value": "[-90.000,-10.000]"
            },
            "maxPhaseAngle": {
                "value": "[0.000,0.000]"
            },
            "requiredSerialNumber": {
                "value": ""
            },
            "returnCode": {
                "value": 2
            },
            "testResult": {
                "value": 2
            },
            "leftImpedances": {
                "value": "[14008.500,5167.019]"
            },
            "leftPhaseAngle": {
                "value": "[-44.278,-6.764]"
            },
            "rightImpedances": {
                "value": "[14705.699,5804.699]"
            },
            "rightPhaseAngle": {
                "value": "[-40.778,-6.814]"
            },
            "actualSerialNumber": {
                "value": "GER880566"
            }
        }
    ],
    "zeroFlowTest": [
        0.35,
        {
            "numberOfSamples": {
                "value": 50
            },
            "ticksPerSample": {
                "value": 25
            },
            "dutSerialNumber": {
                "value": "TESTATM01"
            },
            "minDutStdDev": {
                "value": 0
            },
            "maxDutStdDev": {
                "value": 0.008
            },
            "minDutAverage": {
                "value": -0.002
            },
            "maxDutAverage": {
                "value": 0.002
            },
            "returnCode": {
                "value": 2
            },
            "testResult": {
                "value": 2
            },
            "dutSensorStatus": {
                "value": 100512
            },
            "standardDeviationDut": {
                "value": 0.00166
            },
            "runningAverageDut": {
                "value": -0.000326
            },
            "flowSource": {
                "value": "ATMObj1200"
            },
            "samplesTaken": {
                "value": 50
            },
            "sampleTime": {
                "value": 12860
            },
            "refSensorStatus": {
                "value": 0
            }
        }
    ],
    "setFlow": [
        24,
        {
            "stabilisationTime": {
                "value": 8000
            }
        }
    ],
    "flowTest": [
        30000,
        {
            "numberOfSamples": {
                "value": 50
            },
            "ticksPerSample": {
                "value": 25
            },
            "dutSerialNumber": {
                "value": "TESTATM01"
            },
            "refSerialNumber": {
                "value": "20180612_30"
            },
            "minDutAverageDeviation": {
                "value": -15
            },
            "maxDutAverageDeviation": {
                "value": 10
            },
            "minRefAverage": {
                "value": 0.35
            },
            "maxRefAverage": {
                "value": 0.45
            },
            "minDutStdDev": {
                "value": 0.0001
            },
            "maxDutStdDev": {
                "value": 0.02
            },
            "minRefStdDev": {
                "value": 0.0001
            },
            "maxRefStdDev": {
                "value": 0.01
            },
            "maxDutTemperature": {
                "value": 999999999999.9
            },
            "minDutTemperature": {
                "value": -999999999999.9
            },
            "sizeFactor": {
                "value": 4.469
            },
            "returnCode": {
                "value": 2
            },
            "testResult": {
                "value": 2
            },
            "standardDeviationDut": {
                "value": 0.008271
            },
            "standardDeviationRef": {
                "value": 0.002798
            },
            "temperatureDut": {
                "value": -55
            },
            "temperatureRef": {
                "value": 27.447506
            },
            "runningAverageDut": {
                "value": 0.38066
            },
            "runningAverageRef": {
                "value": 0.41175
            },
            "sampleTime": {
                "value": 16380
            },
            "flowSource": {
                "value": "ATMObj1200"
            },
            "samplesTaken": {
                "value": 50
            }
        }
    ],
    "prevSerialNumber": [
        "22811844"
    ],
    "dataTimeStamp": [
        "2022-08-29T08:07:52.738Z"
    ],
    "coil": [
        {
            "product": {
                "value": "Coil"
            },
            "articleCode": {
                "value": "4008043701"
            },
            "revision": {
                "value": "000"
            },
            "status": {
                "value": 4
            },
            "readCode": {
                "value": "4008043701 000 2108 24284 62@ 1600"
            },
            "measuredTrayPosition": {
                "value": "[15949.899,6470.490]",
                "->": {
                    "x": {
                        "value": 189
                    },
                    "y": {
                        "value": 36.5
                    },
                    "z": {
                        "value": 55
                    }
                }
            },
            "trayDelta": {
                "value": 2,
                "->": {
                    "x": {
                        "value": 1.164398
                    },
                    "y": {
                        "value": -2.17178
                    },
                    "rz": {
                        "value": -0.148381
                    }
                }
            }
        },
        {
            "uBracket": {
                "->": {
                    "product": {
                        "value": "Ubracket"
                    },
                    "status": {
                        "value": 1
                    }
                }
            }
        }
    ],
    "eCable": [
        {
            "product": {
                "value": "Ecable"
            },
            "status": {
                "value": 2
            },
            "number": {
                "value": 27
            }
        }
    ],
    "tube": [
        {
            "articleCode": {
                "value": "4005945302"
            },
            "status": {
                "value": 6
            },
            "product": {
                "value": "Tube"
            },
            "trayCode": {
                "value": "04447 4005945302 003"
            },
            "cmdDispense1": {
                "value": "003",
                "->": {
                    "dispenseTime": {
                        "value": 50
                    },
                    "pressureSetPoint": {
                        "value": 4.1
                    }
                }
            },
            "cmdDispense2": {
                "value": 50,
                "->": {
                    "dispenseTime": {
                        "value": 50
                    },
                    "pressureSetPoint": {
                        "value": 4.1
                    }
                }
            }
        }
    ]
}

Thanks!

This helped! Works fine now.

Thanks for your answer!

I cannot unfortunately clean the JSON easily because it comes from an external machine.

I can in theory but would take a lot of effort so the above mentioned solution helps already.

Thanks anyway!

I suspect you misunderstood.

@E1cid was not suggesting you can clean it up at the source but instead suggesting you clean it up inside node-red (and he provided a demo flow for you that does just that)

Oh yes i clearly misunderstood! Sorry about that!

Im going to look into that as well!

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