Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How I get value from JSON React Native?

This is my JSON response. Can you please tell me how can I get daily array values?
When I print console.log(data.timezone), It is working but how can I print daily[0].temp[0].day

{
  "lat": 7.3127,
  "lon": 80.6831,
  "timezone": "Asia/Colombo",
  "daily": [
    {
      "dt": 1639290600,
      "sunrise": 1639269596,
      "temp": {
        "day": 28.45,
        "min": 19.96,
        "max": 28.6,
      }
    },
    {
      "dt": 1639290600,
      "sunrise": 1639269596,
      "temp": {
        "day": 28.45,
        "min": 19.96,
        "max": 28.6,
      }
    }
    {
      "dt": 1639290600,
      "sunrise": 1639269596,
      "temp": {
        "day": 28.45,
        "min": 19.96,
        "max": 28.6,
      }
    }
    
  ]
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

temp is not array ! is Object so you cant get index

console.log(data.daily[0].temp.day)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading