public ActionResult JSonEvento() { string json = ""; Service1Client client = new Service1Client(); var query = client.get_eventos(); if (query == null) { json += "{" + String.Format("\"descripcion\":\"{0}\",\"fecha\":\"{1}\"", "0", "Null") + "}"; json = "{\"draw\": 1,\"recordsTotal\": 1,\"recordsFiltered\": 1,\"data\": [" + json + "]}"; return Content(json); } for (int i = 0; i < query.Count(); i++) { var f = client.get_fecha_eventos(query.ElementAt(i)); List<string> fechas = new List<string>(); foreach (var item in f) { fechas.Add(item); } string cadenaf = concatenar_fechas(fechas); if (!json.Equals("")) { json += ","; } json += "{" + String.Format("\"descripcion\":\"{0}\",\"fecha\":\"{1}\"", query.ElementAt(i), cadenaf) + "}"; } json = "{\"draw\": 1,\"recordsTotal\": 1,\"recordsFiltered\": 1,\"data\": [" + json + "]}"; return Content(json); }