答案格式json.Forecast包含日期格式的键:
forecast: {,…}
2015-12-08: {nightTemperature: {min: "+2", max: "+4"}, dayTemperature: {min: "+2", max: "+4"}, phenomena: "Ясно",…}
dateTextDayOfWeek: "завтра"
dayOfMonth: "8"
dayTemperature: {min: "+2", max: "+4"}
falloutIcon: "A2"
humidityTitle: "75%"
nightTemperature: {min: "+2", max: "+4"}
phenomena: "Ясно"
pressureTitle: "776 мм рт. ст."
weekend: ""
wind: {direction: {title: "северо-западный", abbr: {rus: "СЗ", eng: "nw"}}, speed: [5, 7], gustsSpeed: 10,…}
windDirection: "NW"
2015-12-09: {nightTemperature: {min: "0", max: "-2"}, dayTemperature: {min: "0", max: null},…}
2015-12-10: {nightTemperature: {min: "0", max: "-2"}, dayTemperature: {min: "+2", max: "+4"},…}
2015-12-11: {nightTemperature: {min: "0", max: "+2"}, dayTemperature: {min: "0", max: "+2"},…}
2015-12-12: {nightTemperature: {min: "0", max: null}, dayTemperature: {min: "0", max: "+2"},…}
我的课程
public class Forecast
{
public Day day { get; set; }
}
public class Day
{
public string dateTextDayOfWeek { get; set; }
public string dayOfMonth { get; set; }
public DayTemperature dayTemperature { get; set; }
public string falloutIcon { get; set; }
public string humidityTitle { get; set; }
public NightTemperature nightTemperature { get; set; }
public string phenomena { get; set; }
public string pressureTitle { get; set; }
public string weekend { get; set; }
public Wind wind { get; set; }
public string windDirection { get; set; }
}
如何引入类预测以成功反序列化集合对象?
答案 0 :(得分:0)
你不能对这个Json进行Deserialaze,它是无效的。 收集日期的json应如下所示:
days:[
{ dateTextDayOfWeek : "your date",
dayOfMonth : "your date",
dayTemperature :{...},
falloutIcon : ""
....
},{ dateTextDayOfWeek : "your date",
dayOfMonth : "your date",
dayTemperature :{...},
falloutIcon : ""
....
}
]
等等。 但是我没有在你的样本中看到任何收藏品。 你的forcast对象应该是这样的:
forcast:{
day:{ dateTextDayOfWeek : "your date",
dayOfMonth : "your date",
dayTemperature :{...},
falloutIcon : ""
....
}
}