How to extract values from an Object?

Could you please help me to find out how to get data from an object with variables with special signs ?

msg.payload = msg.payload.SDS0X1."PM2.5";
msg.payload = msg.payload.SDS0X1.[PM2.5];
msg.payload = msg.payload.SDS0X1.'PM2.5';
return msg;

none of these works ...

Without knowing what the data looks like, it will be hard to help you.

Connect a debug node to what ever is giving you the data. Then open all the levels of the object and paste it to a reply.

Maybe try msg.payload = msg.payload.SDS0X1["PM2.5"];
you either use . or [" "]

1 Like

Hi @Golonder

This page in the docs shows how you can use the Debug sidebar to find out the path to any element of a message. It will give you the properly formatted expression to access the property.

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