Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
How to read data from Json response from openweathermap

I get a response like this from Openweathermaps API, and i honsetly don't know how to get to data that is deeper, I'm working in react-native. This is my function that I use to get the data from the API.

const getWeatherData = async (savedPlacesData) =>{

  if(dataToRender!=null){
    dataToSave = dataToRender
  }

  console.log(savedPlacesData)
  const options = {
    method: 'GET',
    url: 'https://community-open-weather-map.p.rapidapi.com/weather',
    params: {q: savedPlacesData.name, callback: 'test', lang: 'null', units: 'metric'},
    headers: {
      'x-rapidapi-host': 'community-open-weather-map.p.rapidapi.com',
      'x-rapidapi-key': 'e01436d70bmsh6fcef67bef75173p1660f2jsncb27dc744b4b'
    }
  };
  
  axios.request(options).then(function (response) {

    console.log(response.data)
    setDataToRender(dataToSave);

  }).catch(function (error) {
    console.error(error);
  });

}

And this is the response data that I get.

test({
   "coord":{
      "lon":21.0744,
      "lat":50.3096
   },
   "weather":[
      {
         "id":803,
         "main":"Clouds",
         "description":"broken clouds",
         "icon":"04d"
      }
   ],
   "base":"stations",
   "main":{
      "temp":1.2,
      "feels_like":-3.9,
      "temp_min":1.2,
      "temp_max":1.2,
      "pressure":1034,
      "humidity":58,
      "sea_level":1034,
      "grnd_level":1014
   },
   "visibility":10000,
   "wind":{
      "speed":5.94,
      "deg":70,
      "gust":7.65
   },
   "clouds":{
      "all":57
   },
   "dt":1646037631,
   "sys":{
      "country":"PL",
      "sunrise":1646025730,
      "sunset":1646064885
   },
   "timezone":3600,
   "id":757388,
   "name":"Szczucin",
   "cod":200
})

how to get to weather description for example?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

probably remove callback: 'test' from the param. That way you would be able to access the weather description

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!