Extract a Value


#1

Hello,
I have this payload (http get) How can I extract the Value for "PAC"

{
"Body" : {
"Data" : {
"DAY_ENERGY" : {
"Unit" : "Wh",
"Value" : 8718
},
"DeviceStatus" : {
"ErrorCode" : 0,
"LEDColor" : 2,
"LEDState" : 0,
"MgmtTimerRemainingTime" : -1,
"StateToReset" : false,
"StatusCode" : 7
},
"FAC" : {
"Unit" : "Hz",
"Value" : 49.990000000000002
},
"IAC" : {
"Unit" : "A",
"Value" : 14.470000000000001
},
"IDC" : {
"Unit" : "A",
"Value" : 7.5300000000000002
},
"PAC" : {
"Unit" : "W",
"Value" : 3371
},
"TOTAL_ENERGY" : {
"Unit" : "Wh",
"Value" : 608459.06000000006
},
"UAC" : {
"Unit" : "V",
"Value" : 232.09999999999999
},
"UDC" : {
"Unit" : "V",
...


#2

See Msg.payload to influxdb


#3


#4

Hi @alex2,

That shows your message is a JSON string. The first step is to convert that to a JavaScript object so you can access its contents.

Add a JSON node to your flow.

You can then use the debug sidebar to help you identify the right path to the element you are interested in.

This page of the docs should help explain how to do that: https://nodered.org/docs/user-guide/messages


#5

Thank you