后台 返回序列化的 JSon

 
string msg = context.Request["msg"];
            JavaScriptSerializer js = new JavaScriptSerializer();

            Dictionary<string, string> dic = new Dictionary<string, string>()
            {
                {"Time1", "2015.11.251111" }
            };
            dic.Add("Time", "2015.11.25");
            dic.Add("Data", "2013.11.10");

            string jsonstr = js.Serialize(new
            {
                Url = msg,
                People = new
                {
                    Name = "大头",
                    Age = "19"
                },
                Dic = dic
            });

            HttpContext.Current.Response.Write(jsonstr);
 
原文地址:https://www.cnblogs.com/demoC/p/5100538.html