无法将当前JSON对象反序列化为System.Collections.Generic.List类型
问题描述:
为什么我一直得到:
未处理的异常:
答
我通过json将json运回c#转换器。 我不打算包含所有生成的类,但是根对象返回一个DailyForecast列表。 您只需要进入根对象而不是根对象列表
I ran the json back through a json to c# converter. I am not going to include all the classes generated but the root object returns an List of DailyForecast. You only need to into a root object not a List of root objects
var result = JsonConvert.DeserializeObject<AccuWeather5DaysForecast.RootObject>(json_5days_forecast);