Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda