下面的代码不会返回任何错误,但仍不会将JSON转换为对象
我从API获得的JSON字符串
{
"genres": [
{
"id": 28,"name": "action"
},{
"id": 12,"name": "Adventure"
}
]
}
一般考试班
public class Test
{
public int id;
public string Name;
}
下面的代码显示了我如何尝试将JSON字符串转换为Test类的列表
string JsontStr = GenreService.get();
var Serializer = new JavaScriptSerializer();
List<Test> a = (List<Test>)Serializer.Deserialize(JsontStr,typeof(List<Test>));
an image of what the object a has in it when the program has finished running