我有一个来自openweathermap的JSON列表weatherforecast,我的问题是:如何获取所有5天18:00:00的天气数据。如何从列表中删除数据?
$.support.cors = true;
$.ajax({
url: "https://api.openweathermap.org/data/2.5/forecast?q=hamburg&units=metric&APPID=apikey",
cache: false,
success: function (dataForecast) {
$("#tempMo").append(dataForecast.list[0].main.temp_max + "c");
$.inArray("18:00:00", dataForecast.list)
答案 0 :(得分:0)
{
"cod": "200",
"message": 0.0047,
"cnt": 40,
"list": [
{
"dt": 1553785200,
"main": {
"temp": 11.98,
"temp_min": 11.98,
"temp_max": 12.14,
"pressure": 1033.34,
"sea_level": 1033.34,
"grnd_level": 1028.71,
"humidity": 78,
"temp_kf": -0.16
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"clouds": {
"all": 68
},
"wind": {
"speed": 3.93,
"deg": 320.508
},
"rain": {
"3h": 0.015
},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-28 15:00:00"
},
{
"dt": 1553796000,
"main": {
"temp": 10.91,
"temp_min": 10.91,
"temp_max": 11.03,
"pressure": 1033.72,
"sea_level": 1033.72,
"grnd_level": 1029.13,
"humidity": 77,
"temp_kf": -0.12
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10n"
}
],
"clouds": {
"all": 76
},
"wind": {
"speed": 2.91,
"deg": 319.003
},
"rain": {
"3h": 0.005
},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-28 18:00:00"
},
{
"dt": 1553806800,
"main": {
"temp": 8.69,
"temp_min": 8.69,
"temp_max": 8.77,
"pressure": 1034.46,
"sea_level": 1034.46,
"grnd_level": 1029.98,
"humidity": 86,
"temp_kf": -0.08
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10n"
}
],
"clouds": {
"all": 24
},
"wind": {
"speed": 2.63,
"deg": 312.002
},
"rain": {
"3h": 0.01
},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-28 21:00:00"
},
{
"dt": 1553817600,
"main": {
"temp": 5.12,
"temp_min": 5.12,
"temp_max": 5.16,
"pressure": 1034.12,
"sea_level": 1034.12,
"grnd_level": 1029.66,
"humidity": 95,
"temp_kf": -0.04
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 1.3,
"deg": 232.007
},
"rain": {
"3h": 0.005
},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-29 00:00:00"
},
{
"dt": 1553828400,
"main": {
"temp": 3.34,
"temp_min": 3.34,
"temp_max": 3.34,
"pressure": 1033.3,
"sea_level": 1033.3,
"grnd_level": 1028.64,
"humidity": 91,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 1.31,
"deg": 198.501
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-29 03:00:00"
},
{
"dt": 1553839200,
"main": {
"temp": 3.85,
"temp_min": 3.85,
"temp_max": 3.85,
"pressure": 1032.89,
"sea_level": 1032.89,
"grnd_level": 1028.24,
"humidity": 86,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 2.22,
"deg": 205.009
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-29 06:00:00"
},
{
"dt": 1553850000,
"main": {
"temp": 11.34,
"temp_min": 11.34,
"temp_max": 11.34,
"pressure": 1032.31,
"sea_level": 1032.31,
"grnd_level": 1027.8,
"humidity": 89,
"temp_kf": 0
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 3.65,
"deg": 231.005
},
"rain": {
"3h": 0.005
},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-29 09:00:00"
},
{
"dt": 1553860800,
"main": {
"temp": 14.27,
"temp_min": 14.27,
"temp_max": 14.27,
"pressure": 1030.73,
"sea_level": 1030.73,
"grnd_level": 1026.24,
"humidity": 81,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "02d"
}
],
"clouds": {
"all": 8
},
"wind": {
"speed": 5.26,
"deg": 244.002
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-29 12:00:00"
},
{
"dt": 1553871600,
"main": {
"temp": 14.73,
"temp_min": 14.73,
"temp_max": 14.73,
"pressure": 1028.76,
"sea_level": 1028.76,
"grnd_level": 1024.33,
"humidity": 72,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 5.01,
"deg": 253.507
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-29 15:00:00"
},
{
"dt": 1553882400,
"main": {
"temp": 12.09,
"temp_min": 12.09,
"temp_max": 12.09,
"pressure": 1027.67,
"sea_level": 1027.67,
"grnd_level": 1023.22,
"humidity": 68,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 3.22,
"deg": 252.503
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-29 18:00:00"
},
{
"dt": 1553893200,
"main": {
"temp": 7.99,
"temp_min": 7.99,
"temp_max": 7.99,
"pressure": 1027.11,
"sea_level": 1027.11,
"grnd_level": 1022.56,
"humidity": 88,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 2.52,
"deg": 238.502
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-29 21:00:00"
},
{
"dt": 1553904000,
"main": {
"temp": 5.35,
"temp_min": 5.35,
"temp_max": 5.35,
"pressure": 1026.24,
"sea_level": 1026.24,
"grnd_level": 1021.73,
"humidity": 88,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 1.25,
"deg": 241.5
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-30 00:00:00"
},
{
"dt": 1553914800,
"main": {
"temp": 4.34,
"temp_min": 4.34,
"temp_max": 4.34,
"pressure": 1024.74,
"sea_level": 1024.74,
"grnd_level": 1020.17,
"humidity": 84,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 1.58,
"deg": 200.506
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-30 03:00:00"
},
{
"dt": 1553925600,
"main": {
"temp": 5.69,
"temp_min": 5.69,
"temp_max": 5.69,
"pressure": 1023.53,
"sea_level": 1023.53,
"grnd_level": 1018.95,
"humidity": 85,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 3.8,
"deg": 214.01
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-30 06:00:00"
},
{
"dt": 1553936400,
"main": {
"temp": 12.49,
"temp_min": 12.49,
"temp_max": 12.49,
"pressure": 1022.76,
"sea_level": 1022.76,
"grnd_level": 1018.24,
"humidity": 82,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 4.5,
"deg": 231
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-30 09:00:00"
},
{
"dt": 1553947200,
"main": {
"temp": 15.47,
"temp_min": 15.47,
"temp_max": 15.47,
"pressure": 1021.13,
"sea_level": 1021.13,
"grnd_level": 1016.69,
"humidity": 77,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 5.56,
"deg": 253.006
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-30 12:00:00"
},
{
"dt": 1553958000,
"main": {
"temp": 15.05,
"temp_min": 15.05,
"temp_max": 15.05,
"pressure": 1019.84,
"sea_level": 1019.84,
"grnd_level": 1015.41,
"humidity": 68,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04d"
}
],
"clouds": {
"all": 76
},
"wind": {
"speed": 6.26,
"deg": 276.501
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-30 15:00:00"
},
{
"dt": 1553968800,
"main": {
"temp": 11.18,
"temp_min": 11.18,
"temp_max": 11.18,
"pressure": 1020.08,
"sea_level": 1020.08,
"grnd_level": 1015.72,
"humidity": 63,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01n"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 5.35,
"deg": 294.003
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-30 18:00:00"
},
{
"dt": 1553979600,
"main": {
"temp": 7.1,
"temp_min": 7.1,
"temp_max": 7.1,
"pressure": 1021.4,
"sea_level": 1021.4,
"grnd_level": 1016.89,
"humidity": 79,
"temp_kf": 0
},
"weather": [
{
"id": 801,
"main": "Clouds",
"description": "few clouds",
"icon": "02n"
}
],
"clouds": {
"all": 12
},
"wind": {
"speed": 4.09,
"deg": 308
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-30 21:00:00"
},
{
"dt": 1553990400,
"main": {
"temp": 5.48,
"temp_min": 5.48,
"temp_max": 5.48,
"pressure": 1022.18,
"sea_level": 1022.18,
"grnd_level": 1017.64,
"humidity": 95,
"temp_kf": 0
},
"weather": [
{
"id": 802,
"main": "Clouds",
"description": "scattered clouds",
"icon": "03n"
}
],
"clouds": {
"all": 36
},
"wind": {
"speed": 3.51,
"deg": 315.004
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-31 00:00:00"
},
{
"dt": 1554001200,
"main": {
"temp": 4.57,
"temp_min": 4.57,
"temp_max": 4.57,
"pressure": 1023.18,
"sea_level": 1023.18,
"grnd_level": 1018.66,
"humidity": 92,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04n"
}
],
"clouds": {
"all": 56
},
"wind": {
"speed": 3.47,
"deg": 321.501
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-31 03:00:00"
},
{
"dt": 1554012000,
"main": {
"temp": 4.62,
"temp_min": 4.62,
"temp_max": 4.62,
"pressure": 1024.67,
"sea_level": 1024.67,
"grnd_level": 1020.08,
"humidity": 84,
"temp_kf": 0
},
"weather": [
{
"id": 801,
"main": "Clouds",
"description": "few clouds",
"icon": "02d"
}
],
"clouds": {
"all": 24
},
"wind": {
"speed": 3.53,
"deg": 337.001
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-31 06:00:00"
},
{
"dt": 1554022800,
"main": {
"temp": 7.4,
"temp_min": 7.4,
"temp_max": 7.4,
"pressure": 1026.58,
"sea_level": 1026.58,
"grnd_level": 1022.03,
"humidity": 79,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 4.56,
"deg": 358.009
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-31 09:00:00"
},
{
"dt": 1554033600,
"main": {
"temp": 8.55,
"temp_min": 8.55,
"temp_max": 8.55,
"pressure": 1027.53,
"sea_level": 1027.53,
"grnd_level": 1022.98,
"humidity": 76,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "02d"
}
],
"clouds": {
"all": 8
},
"wind": {
"speed": 4.68,
"deg": 355.001
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-31 12:00:00"
},
{
"dt": 1554044400,
"main": {
"temp": 7.77,
"temp_min": 7.77,
"temp_max": 7.77,
"pressure": 1027.92,
"sea_level": 1027.92,
"grnd_level": 1023.41,
"humidity": 67,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04d"
}
],
"clouds": {
"all": 64
},
"wind": {
"speed": 4.21,
"deg": 1.00049
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-03-31 15:00:00"
},
{
"dt": 1554055200,
"main": {
"temp": 5.94,
"temp_min": 5.94,
"temp_max": 5.94,
"pressure": 1028.8,
"sea_level": 1028.8,
"grnd_level": 1024.2,
"humidity": 60,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04n"
}
],
"clouds": {
"all": 56
},
"wind": {
"speed": 2.56,
"deg": 6.00009
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-31 18:00:00"
},
{
"dt": 1554066000,
"main": {
"temp": 3.91,
"temp_min": 3.91,
"temp_max": 3.91,
"pressure": 1030.12,
"sea_level": 1030.12,
"grnd_level": 1025.42,
"humidity": 63,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04n"
}
],
"clouds": {
"all": 56
},
"wind": {
"speed": 1.36,
"deg": 29.0056
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-03-31 21:00:00"
},
{
"dt": 1554076800,
"main": {
"temp": 3.13,
"temp_min": 3.13,
"temp_max": 3.13,
"pressure": 1030.55,
"sea_level": 1030.55,
"grnd_level": 1025.91,
"humidity": 64,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04n"
}
],
"clouds": {
"all": 80
},
"wind": {
"speed": 0.97,
"deg": 355.003
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-04-01 00:00:00"
},
{
"dt": 1554087600,
"main": {
"temp": 2.94,
"temp_min": 2.94,
"temp_max": 2.94,
"pressure": 1030.73,
"sea_level": 1030.73,
"grnd_level": 1026.06,
"humidity": 67,
"temp_kf": 0
},
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04n"
}
],
"clouds": {
"all": 68
},
"wind": {
"speed": 1.36,
"deg": 2.50177
},
"rain": {},
"sys": {
"pod": "n"
},
"dt_txt": "2019-04-01 03:00:00"
},
{
"dt": 1554098400,
"main": {
"temp": 2.29,
"temp_min": 2.29,
"temp_max": 2.29,
"pressure": 1030.85,
"sea_level": 1030.85,
"grnd_level": 1026.21,
"humidity": 71,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "02d"
}
],
"clouds": {
"all": 8
},
"wind": {
"speed": 1.32,
"deg": 36
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-04-01 06:00:00"
},
{
"dt": 1554109200,
"main": {
"temp": 6.72,
"temp_min": 6.72,
"temp_max": 6.72,
"pressure": 1031.22,
"sea_level": 1031.22,
"grnd_level": 1026.71,
"humidity": 83,
"temp_kf": 0
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 2.11,
"deg": 83.0005
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-04-01 09:00:00"
},
{
"dt": 1554120000,
"main": {
"temp": 8,
"temp_min": 8,
"temp_max": 8,
"pressure": 1029.87,
"sea_level": 1029.87,
"grnd_level": 1025.33,
"humidity": 84,
"temp_kf": 0
},
"weather": [
{
"id": 801,
"main": "Clouds",
"description": "few clouds",
"icon": "02d"
}
],
"clouds": {
"all": 12
},
"wind": {
"speed": 2.28,
"deg": 109
},
"rain": {},
"sys": {
"pod": "d"
},
"dt_txt": "2019-04-01 12:00:00"
}