public List <Dictionary <string, object> > getBatchDetails(HttpRequestMessage req) { var postedString = req.Content.ReadAsStringAsync().Result; //JArray v = JArray.Parse(postedString); string batchId = Convert.ToString(postedString); obj = new DSL(); DataTable dt; dt = obj.getBatchDetails(batchId); JavaScriptSerializer serializer = new JavaScriptSerializer(); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row; foreach (DataRow dr in dt.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); } rows.Add(row); } return(rows); }