public void BaoCaoDoanhSoNhapKhoDetail(int id_phongban) { Kho kho = new Kho(); DataTable tb = kho.BaoCaoDoanhSoNhapKhoDetail(id_phongban); var js = new JavaScriptSerializer(); List <Dictionary <string, object> > parentRow = new List <Dictionary <string, object> >(); Dictionary <string, object> childRow; foreach (DataRow row in tb.Rows) { childRow = new Dictionary <string, object>(); foreach (DataColumn col in tb.Columns) { childRow.Add(col.ColumnName, row[col]); } parentRow.Add(childRow); } Context.Response.Write(JsonConvert.SerializeObject(parentRow)); }