Template set device state from a json

Hi,

I’m trying to write the template for a “Device: state” workflow node in order to get a value that is inside a json array which I obtained decoding a message.

Below is the json I get, I want to get the values remarked in red. I have tried with this template

{{data.jsonDecoded.w2r.rmt.[0].[3]}}

I think the problem is that the name of the array has a dot “w2r.rmt”.

Is there anyway to write the template for this situation?

Thanks

Hi @PABLO_RODRIGUEZ and welcome to the Losant Forums!

I think the problem is that the name of the array has a dot “w2r.rmt”.

You’re correct; because that property has a dot in the name you need to use bracket notation for that portion of the path like so:

{{data.jsonDecoded.[w2r.rmt].[0].[3]}}

Let us know if you have any other questions!

1 Like

Thanks a lot @Dylan_Schuster ,

Your suggesttion solved my doubt