1π
// This Is edited Code for encode json for $info[βdataβ]
public function chartjs(){
$info['title'] = 'Chartjs';
$post_data = $this->post_model->get_posts();
$info['data'] = json_encode($post_data);
$this->load->view('templates/header');
$this->load->view('chartjs',$info);
$this->load->view('templates/footer');
}
I am sure help of this code You can encode json correctly.
Thanks,
Kamiyab ali
Source:stackexchange.com