TypeError: Cannot read property

41 views
Skip to first unread message

Mikael Holmberg

unread,
Jan 1, 2018, 6:08:32 PM1/1/18
to Node-RED UI
Hi,

Now i relly need som help.

I have a Json payload that's look like this:

{"d":{"address":"101c8d92010800c1","value":22.56}}

I need to seperate this data depending on the adress. But then a connect the flow to a switch with the following configuration:



I get the error:

msg : error"TypeError: Cannot read property 'address' of undefined"

any tip?

//Micke


Auto Generated Inline Image 1

Nick O'Leary

unread,
Jan 1, 2018, 6:11:04 PM1/1/18
to Mikael Holmberg, Node-RED UI

Is your payload a json string or a JavaScript object? Passing it to a debug node will show you in the sidebar.

If it's a string, pass the message through a JSON node to parse it to a JavaScript object. You will then be able to access the individual properties it contains.

Nick


--
You received this message because you are subscribed to the Google Groups "Node-RED UI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red-contri...@googlegroups.com.
To post to this group, send email to node-red-...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red-contrib-ui/51f7b885-3411-4058-99a5-073b775984cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mikael Holmberg

unread,
Jan 1, 2018, 6:23:14 PM1/1/18
to Node-RED UI
Hi Nick,

I was shure i tried that... BUT after your tip i tried agin and yes.. You had the solution!

Thanks!

//Micke

Reply all
Reply to author
Forward
0 new messages