C#中任意类型数据转成JSON格式 时间:2016-09-22 04:51:15 【文件属性】: 文件名称:C#中任意类型数据转成JSON格式 文件大小:19KB 文件格式:DOCX 更新时间:2016-09-22 04:51:15 转成JSON List转成json public static string ListToJson(IList list, string jsonName) { StringBuilder Json = new StringBuilder(); if (string.IsNullOrEmpty(jsonName)) jsonName = list[0].GetType().Name; Json.Append("{\"" + jsonName + "\":["); if (list.Count > 0) 对象集合转换Json 普通集合转换Json DataTable转成Json DataReader转换为Json DataSet转换为Json 立即下载