Function to extract details from nested objects

Hello all,

I want to create a Function to extract id and last_seen from the object below but im not sure how to get the 2nd object out.

For example, would expect to write

msg.payload = [
measurement: msg.pyaload."eui-000080029c09e021".id
return msg;

but I just get the error below "expected an indentifier and instead saw




Use "copy path" to get the path to the item in the object (then add the msg. part to the begining)

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.


brill got it, just the brackets i was missing


you need to use square bracket notaion.

measurement: msg.pyaload["eui-000080029c09e021"].id
1 Like

If I want to put the description value "UfL0_..." in site of measurement key {measurement: ...} how may I do? Automatically.

Welcome to the forum @maiconcarlosp

First, did you see @Steve-Mcl's post, marked as the solution to this thread, and have you read and understood it? If that didn't help then please give us more information on exactly what you don't know how to do. Show an example of what you start with and what you want the result to be.

I see that you asked the question again in a new thread. Please don't double post questions. I also notice that you marked as the solution exactly the solution shown earlier in this thread.

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