更新时间:2023-01-17 21:24:26
您的JSON数据具有两个主要元素 metadata 和 results .并且根据您的类结构,流派类也具有相同的结构.但是在您的代码中,您尝试将结构反序列化为 Results ,这就是您收到错误的原因.
您应该尝试将序列化反序列化为 Genres 类.
新代码将类似于
Your JSON data has two main elements metadata and results. And according to you class structure, the Genres class also has the same structure. But in your code you are trying to de-serialize the structure to Results, thats why you are getting the error.
You should try to de-serialize to Genres class.
The new code will be something like
void beatportTest_GetDataCompleted(object sender, DownloadStringCompletedEventArgs e)
{
try
{
Genres data = JsonConvert.DeserializeObject(e.Result);
// for-each loop to display data
}
catch(Exception ex)
{
}
}
java.lang.RuntimeException:无法反序列化对象.无法将类型java.lang.Long的值转换为布尔值
将JSON转换为对象失败-无法将当前JSON对象反序列化为System.Collections.Generic.List
无法将类型'system.collections.generic.list dynamic隐式转换为system.collection.generic.list到mvc.user
无法将类型'System.Collections.Generic.List转换为'System.Collections.Generic.List
在 C# 中使用 weka:无法将“java.util.ArrayList"类型的对象转换为“System.Collections.Generic.List"
Jackson ObjectMapper无法反序列化POJO,抛出异常:没有为类型[...]找到合适的构造函数:无法从JSON对象实例化
无法将当前 JSON 对象(例如 {“name":“value"})反序列化为类型“System.Collections.Generic.List"1