1,将对象序列化为JSON对象
Dictionary<string,object> tr = new Dictionary<string,object>();
tr.Add("rows", result);
//序列化对象为JSON
JavaScriptSerializer serialize = new JavaScriptSerializer();
context.Response.Write(serialize.Serialize(tr));
2,在方法上面声明[WebMethod]
3,待序列化对象上注明 [DataContract]