Good day. I have a request to OpenWeatherMap, I get the answer in the form of JSON, something like this:

{"coord":{"lon":41.43,"lat":52.73},"weather":[{"id":803,"main":"Clouds","description":"пасмурно","icon":"04n"}],"base":"cmc stations","main":{"temp":2.82,"pressure":1013.44,"humidity":87,"temp_min":2.82,"temp_max":2.82,"sea_level":1033.23,"grnd_level":1013.44},"wind":{"speed":1.7,"deg":176.5},"clouds": 

The problem itself is that I cannot take a description of the weather from this answer. Those. The variable.weather.description command for some reason does not work, as with the other parameters. I apologize in advance for a stupid question.

  • 2
    variable.weather[0].description - Igor
  • @Igor Thank you, that's what I was looking for) - Omfis

1 answer 1

  1. You didn’t have JSON in question.
  2. To parse json you need to use JSON.parse .
  3. variable.weather[0].description
  • Yes, I didn’t know that I didn’t think that it was important) Yes, I also used JSON.parse, it just didn’t result in the code. - Omfis
  • @Omfis, then the answer is in Igor's comments. - Qwertiy
  • Already used his tip) Thank you, gentlemen. - Omfis