title: Access Json objects data returned by Controller in MVC 4
body: <p>I'm having trouble figuring out a way to access the following json returned from my controller:</p>
  
  <pre><code>[{"ID":1,"seatnum":"A1","status":0},{"ID":2,"seatnum":"A2","status":0}]
  </code></pre>
  
  <p>I am trying to to access the each seatnum value (A1, A2) to perform the following function:</p>
  
  <pre><code>$.ajax({
      url: 'seats/getseats',
      dataType: "JSON",
      error: function (data) {
          $("table tr img").removeClass("available").attr("src", "images/taken.gif");
          alert("error")
      }
  }).done(function (data) {
  
  
      for (var i = 0; i &lt; data.length; i++) {
          //alert(data[i].seatnum);
          var seatLetter = data[i][0];
          var seatNumber = data[i].substr(1);
          var $target = getImgFromSeat(seatLetter, seatNumber);
          $target.removeClass("available").attr("src", "images/taken.gif");
  
      }
  </code></pre>
  
  <p>If it helps my Controller method is:</p>
  
  <pre><code>//
      // GET: /seats/
  
      public ActionResult Index()
      {
          return View(db.seats.ToString());
      }
  
      public JsonResult getseats()
      {
  
  
          var taken = from b in db.seats
                           select b;
  
          taken = taken.Where(b =&gt; b.status.Equals(0));
          return Json(taken, JsonRequestBehavior.AllowGet);
      }
  </code></pre>