Home > front end >  Read JSON object in object in JavaScript
Read JSON object in object in JavaScript

Time:09-26

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!

CodePudding user response:

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

  • Related