在JSON响应中获取未定义

I am using the CodeIgniter shopping cart. I am fetching the all the add to cart information and I am getting the output in the alert(data) but I am not able to check the o.qty. I am getting undefined.

$(document).ready(function() {
      $.ajax({
          url: "<?php echo base_url(); ?>Member_controller/primaryCartload",
          context: document.body,
          success: function(data) {
            //alert(data);

            if (data != 0) {
              console.log(data);
              alert(data);
              var obj = JSON.parse(data);
              $.each(obj, function(i, o) {
                  alert(o.qty);
                  if (o.qty != 0) {
                    $('#subtotal_details').html('Total cost:' + o.subtotal);
                    //alert('not empty');
                  });
              }
              else {
                //alert('empty')
                $('#totalDetails').html('0');
                $('#totalQty').html('Total items:0');
              }
            }
          });
      });

Controller

public function primaryCartload()
 {
  $output=[];
  $count = 0;

  foreach($this->cart->contents() as $items)
  {
   $count++;
   $output[] = array(
            'id' =>$items["id"],
            'qty' =>$items["qty"],
            'subtotal'=>$items["subtotal"],
            'removebtn'=>$items["rowid"],
            'cart_total'=>$this->cart->total()
            );
  }
  $outputStore['outputStore']=$output;
  if($count == 0)
  {
   $outputStore ['outputStore']= 0;
  }
 echo json_encode($outputStore);
 exit();
}

I am getting the output in the alert(data)

{"outputStore":[{"id":"1","qty":1,"subtotal":5000,"removebtn":"c4ca4238a0b923820dcc509a6f75849b","cart_total":6000},{"id":"2","qty":1,"subtotal":1000,"removebtn":"c81e728d9d4c2f636f067f89cc14862c","cart_total":6000}]}

but when I am accessing the o.qty then I am getting undefined

You should take the array from data object.

$(document).ready(function() {
      $.ajax({
          url: "<?php echo base_url(); ?>Member_controller/primaryCartload",
          context: document.body,
          success: function(data) {
            //alert(data);

            if (data != 0) {
              console.log(data);
              alert(data);
              var obj = JSON.parse(data);
              $.each(obj["outputStore"], function(i, o) {
                  alert(o.qty);
                  if (o.qty != 0) {
                    $('#subtotal_details').html('Total cost:' + o.subtotal);
                    //alert('not empty');
                  });
              }
              else {
                //alert('empty')
                $('#totalDetails').html('0');
                $('#totalQty').html('Total items:0');
              }
            }
          });
      });