public static string getJson2(this DataTable dt)
{
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
foreach (DataRow dr in dt.Rows)
{
Dictionary<string, object> result = new Dictionary<string, object>();
foreach (DataColumn dc in dt.Columns)
{
result.Add(dc.ColumnName, dr[dc]);
}
list.Add(result);
}
string resultString = list.ToJson();
string json = @"{""rows"":" + resultString + @",""total"":""" + list.Count + @"""}";
return json;
}