Sun_china

交流更多,收获更多?

博客园 首页 新随笔 联系 订阅 管理
 
1.这里下载:http://www.newtonsoft.com/products/json/
安装:
   1.解压下载文件,得到Newtonsoft.Json.dll
   2.在项目中添加引用
2.引入命名空间
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

3.把datatable转换成json格式
public string GetAllCategory()
{
string result = "";
DataTable dt= catDAO.GetAllCategory();
result=JsonConvert.SerializeObject(dt, new DataTableConverter());
return result;
}
 

 

posted on 2012-05-31 10:06  Sun_china  阅读(245)  评论(0编辑  收藏  举报