public void loadAreas() { try { String AreasOptions = ""; String rowArray = listTable.Get("name", "Area"); JArray rowString = JsonConvert.DeserializeObject <JArray>(rowArray); JArray listas = new JArray(); foreach (JObject obj in rowString) { listas = JsonConvert.DeserializeObject <JArray>(obj["elements"]["unorder"].ToString()); } //listas = listas.OrderByDescending AreasOptions += "<option value='null' selected>Seleccione...</option>"; foreach (JObject puesto in listas) { foreach (KeyValuePair <string, JToken> token in puesto) { AreasOptions += "<option value='" + token.Key + "'"; //setting the id as the value AreasOptions += ">" + token.Value + "</option>"; //setting the text as the name } } ViewData["areaList"] = new HtmlString(AreasOptions); } catch (Exception e) { ViewData["areaList"] = null; } }