With my present code I get the right details from my dbase with json\_encode.

```
 [{
    "tour_id": "1",
    "tour_name": "Test this",
    "start": "2016-01-12 13:21:32",
    "end": "2016-01-15 13:21:35",
    "itinerary_photo": "Desert.jpg"
 }][{
    "tour_id": "3",
    "tour_name": "Everest",
    "start": "2016-02-10 13:23:00",
    "end": "2016-02-18 13:23:07",
    "itinerary_photo": "Chrysanthemum.jpg"
}]

```

**EXPECTED JSON FEED**   

I am using a json feed in order to add an event to fullcalendar. And the format of my json\_encode results should be like this: 

```
[{
    "tour_id": "1",
    "tour_name": "Test this",
    "start": "2016-01-12 13:21:32",
    "end": "2016-01-15 13:21:35",
    "itinerary_photo": "Desert.jpg"
}, {
    "tour_id": "3",
    "tour_name": "Everest",
    "start": "2016-02-10 13:23:00",
    "end": "2016-02-18 13:23:07",
    "itinerary_photo": "Chrysanthemum.jpg"
}]

```

the difference being the objects are stored into one array only. With the output im getting, it displays multiple arrays. 

here is my code for the controller: 

```
public function getBookedCal(){
    if ($this->session->userdata('login')==true){
        $data['twimembers'] = $this->session->userdata('twimembers');
        $data['tour'] = $this->Model_MyBookedTours->getPaidTours($data['twimembers']['user_id']);
        foreach ($data['tour'] as $tourConfirm){
            $tourConfirm = $this->Model_MyBookedTours->getTourInfo($tourConfirm['Tour_packages_tourpkg_id']);
            echo json_encode($tourConfirm);
        }   
        //echo json_encode($tourConfirm); //this outputs only a single array
    }//end if
}//end function

```

MODEL:

```
function getPaidTours($user_id){
    $this->db->where('User_accounts_user_id',$user_id);
    $this->db->where('payment_status','1'); //confirmed
    $query = $this->db->get('user_tourpkg');
    return $query->result_array();
} //calendar

function getTourInfo($tour_id){
    $this->db->select('tour_id,tour_name, start, end, itinerary_photo');
    $this->db->where('tour_id',$tour_id);
    $query = $this->db->get('tour_packages');
    return $query->result();
}

```

**is there any way i could obtain my expected json feed with some tweaks to my code?**