public ActionResult Get(string tablename) { ActionResult result = null; try { List <KeyValuePair <string, string> > parameters = GetParameters(); SQLConnector connector = new SQLConnector(_connectionString); List <List <KeyValuePair <string, object> > > records = connector.GetRecords(tablename, parameters); List <object> objectList = null; foreach (List <KeyValuePair <string, object> > record in records) { Dictionary <string, object> values = new Dictionary <string, object>(); foreach (KeyValuePair <string, object> pair in record) { values.Add(pair.Key, pair.Value); } string jsonString = JsonConvert.SerializeObject(values); if (objectList == null) { objectList = new List <object>(); } objectList.Add(JsonConvert.DeserializeObject(jsonString)); } result = Ok(objectList); } catch (Exception ex) { result = StatusCode(500, new { Error = ex.Message }); } return(result); }