Read JSON object in object in JavaScript

I’m trying to read the below highlighted value:

enter image description here

by reading

str.hourly[2]["rain.1h"]

but getting Undefined error. What is the correct way to access that value?

Thanks in advance!

>Solution :

Simply: str.hourly[2]["rain"]["1h"]; Since rain is an object has 1h property

Leave a Reply