您的C#类映射与json结构不匹配。
解决方案:
class MovieCollection { public IEnumerable<Movie> movies { get; set; }}class Movie { public string title { get; set; }}class Program { static void Main(string[] args) { string jsonString = @"{""movies"":[{""id"":""1"",""title"":""Sherlock""},{""id"":""2"",""title"":""The Matrix""}]}"; JavascriptSerializer serializer = new JavascriptSerializer(); MovieCollection collection = serializer.Deserialize<MovieCollection>(jsonString); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)