Hello, I have the following JSON:
{
"cod": "200",
"message": 0,
"cnt": 40,
"list": [
{
"dt": 1609189200,
"main": {
"temp": 281.34,
"feels_like": 276.87,
"temp_min": 280.51,
"temp_max": 281.34,
"pressure": 1020,
"sea_level": 1020,
"grnd_level": 1019,
"humidity": 63,
"temp_kf": 0.83
},
"weather": [
{
"id": 802,
"main": "Clouds",
"description": "scattered clouds",
"icon": "03d"
}
],
"clouds": {
"all": 28
},
"wind": {
"speed": 3.9,
"deg": 240
},
"visibility": 10000,
"pop": 0,
"sys": {
"pod": "d"
},
"dt_txt": "2020-12-28 21:00:00"
},
{
"dt": 1609200000,
"main": {
"temp": 279.82,
"feels_like": 275.24,
"temp_min": 279.18,
"temp_max": 279.82,
"pressure": 1021,
"sea_level": 1021,
"grnd_level": 1020,
"humidity": 70,
"temp_kf": 0.64
},
"weather": [
{
"id": 801,
"main": "Clouds",
"description": "few clouds",
"icon": "02n"
}
],
"clouds": {
"all": 15
},
"wind": {
"speed": 4.06,
"deg": 225
},
"visibility": 10000,
"pop": 0,
"sys": {
"pod": "n"
},
"dt_txt": "2020-12-29 00:00:00"
},
truncated
I’m trying to get the value of the second weather main, “Clouds”. I’ve tried:
$json["list"][1][0]["weather"]["main"];
$json["list"][1]["weather"]["main"];
but neither have worked. What would be the right answer?