I need JSON output like this,
{"restaurant":[{"id":"89","owner_id":"2161","name":"Bakso ",...}{"id":"90","owner_id":"3400","name":"Soto"}]}
And I do using this query and work perfectly:
$latest_rest = $this->Restaurants_model->getLatestRestaurants($limit)->result();
$jsonObject = array('restaurant'=>$latest_rest);
but i have query with result_array(), because I must filtering this data through function that return result_array();
how do I convert result_array() to result() in CodeIgniter?
result()instead ofresult_array()? Also, if you are just encoding it as JSON anyway, why does it matter if you useresult()orresult_array()? What problem are you trying to solve here exactly? What output are you getting compared to the output you want?