Cannot cast object of type 'Newtonsoft.Json.Linq.JArray' to 'System.Collections.Generic.List`

Cannot cast object of type 'Newtonsoft.Json.Linq.JArray' to 'System.Collections.Generic.List`

Cannot cast object of type 'Newtonsoft.Json.Linq.JArray' to 'System.Collections.Generic.List`

When json returns the format: {['','','***',…]} this kind of data When the type is similar to List but not the same as List, how to convert it to List type?

Solution: First convert the json to JArray,
JArray jArray =(JArray) dt.result;
list = jArray.ToObject< List>();
can solve the problem.

Guess you like

Origin blog.csdn.net/weixin_43298513/article/details/123821105