C#将泛型转换成JSON字符串

ASP.NET 3.5已支持JSON了,在其扩展中System.Web.Extensions.dll。

JavaScriptSerializer serializer = new JavaScriptSerializer();
List zentag = new List();
            zentag.Add(new zen_tag {
                tag_id = 1,
                tag_name = "Nicholas",
                url_show = "Nicholas",
                first_letter = "N",
                count = 500,
                create_time = "2009-10-10 10:10"
            });
            string jsonStr = serializer.Serialize(zentag);


你可能感兴趣的:(ASP.NET)