////// JSON帮助类 /// public static class JsonHelper { ////// 格式化成Json字符串 /// /// 需要格式化的对象 ///Json字符串 public static string ToJson(object obj) { JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Serialize(obj); } ////// 格式化成Json字符串 /// /// 需要格式化的对象 /// 指定序列化的深度 ///Json字符串 public static string ToJson(object obj, int recursionDepth) { JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.RecursionLimit = recursionDepth; return serializer.Serialize(obj); } }