Trying to get property of non-object error during json encode
===

Here is a piece of code i am trying to write. Here i want to retrieve data from the database, store that into an array and then json_ecode it and set is as output. But i keep on getting this error "Trying to get property of non-object".

Here is the code
    $data['query'] = $this->db->get('forms');

    foreach($data['query'] as $row)
      {
	$forms_array[] = array(
	   $row->id 
	 );
      }	

    $return=json_encode($forms_array);
    $this->output->set_output($return);	