/// <summary>
/// 将DataSet中数据,json化
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public string ListToJsonString(DataTable source)
{
StringBuilder result = new StringBuilder();
string fengefu0 = "";
foreach (DataRow row in source.Rows)
{
result.Append(fengefu0 + "{");
fengefu0 = ",";
string fengefu = "";
foreach (DataColumn col in source.Columns)
{
result.Append(fengefu + """ + col.ColumnName + "":" + """ + row[col].ToString().Trim() + """);
fengefu = ",";
}
result.Append("}");
}
result.Insert(0, "[");
result.Append("]");
return result.ToString();
}