Parse json to get particular value

Hi there!

I'm struggling to get some info from an mqtt message parsed as json, as I'm unable to retrieve one of the particular values I need to further build a dashboard.
I've made different approaches with no success.

{"Time":"2021-06-24T18:48:13","ENERGY":{"TotalStartTime":"2021-05-26T15:11:55","Total":17.266,"Yesterday":0.698,"Today":0.469,"Period":0,"Power":44,"ApparentPower":68,"ReactivePower":53,"Factor":0.64,"Voltage":221,"Current":0.308}}

I need to get value "Power" but just the figure, 44

Hope you can help me.

Thanks!

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

https://nodered.org/docs/user-guide/messages

Thank you @Steve-Mcl but that was one approach with no success. I've tried many different ones reading different sources and I'm here asking for help, so if you could develop your answer in a more helpful way I'll really appreciate it :wink:

Thanks

Reading many different posts, I finally set my MQTT Output as "a parsed JSON object" and then with a function (msg.payload = msg.payload.ENERGY.Power
return msg;) sent to Debug outputting "msg.payload".

I get the wanted result but also I get an unexpected error I'm unable figure out where it comes from stating "Invalid JSONata expression: Argument 1 of function "split" does not match function signature"
imagen

Do you have a change node with a JSONata expression in your flow? I can't tell unless you share more information.

If you put the mouse over that error message it should show you which node it is coming from

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