# How to extract a property from an object containing "/"

**URL:** <https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498>\
**Category:** General\
**Created:** [1 September 2021 11:37 UTC](https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498 "2021-09-01T11:37:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [1 September 2021 11:37 UTC](https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498/1 "2021-09-01T11:37:31Z")

</div>

Hi mates, I would use a node that works good, but unfortunately the author decided to output an object which I can't easly address in NR, this is the picture:

 ![example1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/c/fccb807324ddcced8757b1e70af9f22caa3c7eeb.jpeg)

I can't type in a function: `var ADC0 = msg.payload./dev/i2c-1.ads1115.0x4A.singleEnded.channel_0.miliVolts;`  
How can I get that value? Thank you

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 September 2021 11:56 UTC](https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498/2 "2021-09-01T11:56:29Z")

</div>

> [@GiovanniG](#):
>
> var ADC0 = msg.payload./dev/i2c-1.ads1115.0x4A.singleEnded.channel\_0.miliVolts;

This should work  
`let ADC0 = msg.payload["/dev/i2c-1"].ads1115["0x4A"].singleEnded.channel_0.miliVolts;`

Though I note that it is 0x48 in the debug.  
The node red docs page Working with Messages shows you how you can easily copy the path to a property from the debug pane, so avoiding this sort of problem.

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [1 September 2021 12:08 UTC](https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498/3 "2021-09-01T12:08:51Z")

</div>

Thank you, didn't know, I'll remember about it! 🙂  
Why you used let instead of var?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 September 2021 13:09 UTC](https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498/4 "2021-09-01T13:09:29Z")

</div>

> [@GiovanniG](#):
>
> Why you used let instead of var

It is a matter of scoping. In this case it won't make any difference, but nowadays there is no reason to ever use `var` as far as I am aware. One should use the more modern `let` or `const`. If you only set the value of the variable once then it should be `const`.

`var` was introduced, I believe, when javascript was a very simple language and nobody bothered about scoping. Nowadays it is better to scope a variable to the area it is used in order to prevent accidental overwriting by another piece of code.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 October 2021 13:09 UTC](https://discourse.nodered.org/t/how-to-extract-a-property-from-an-object-containing/50498/5 "2021-10-31T13:09:48Z")

</div>

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