Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken.
@@Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken
解决方法
方法参数为[FromBody]object content
JObject jo = (JObject)JsonConvert.DeserializeObject(content.ToString()); JToken[] jtoArray = jo["contentBody"].ToArray(); List<T> contentBody = new List<T>(); foreach (var jto in jtoArray) { contentBody.Add(jto.ToObject<T>()); }
————————————————
版权声明:本文为CSDN博主「qiankunzaici」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qiankunzaici/article/details/89075568