Newtonsoft提供的將DataTable轉成Json:this
/// <summary> /// DataTable轉Json /// </summary> /// <param name="dt"></param> /// <returns></returns> public static string ToJson(this DataTable dt) { return Newtonsoft.Json.JsonConvert.SerializeObject(dt, Newtonsoft.Json.Formatting.None, new Newtonsoft.Json.Converters.DataTableConverter()); }