无法将当前JSON对象反序列化为System.Collections.Generic.List类型 [英] Cannot deserialize the current JSON object into type System.Collections.Generic.List

查看:572
本文介绍了无法将当前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);





这篇关于无法将当前JSON对象反序列化为System.Collections.Generic.List类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆