I have following codes in my controller:
public function actionCabinet($id){
$this->render('cabinet', array('model'=>$this->loadJson($id)) );
}
public function loadJson($id)
{
$jsonfile=ChForms::model()->findByPk($id, array("select"=>"json"));
$decodedJson=json_decode($jsonfile, true);
return $decodedJson;
}
Data is saved in json field in ChForm in json format. I am going to convert it to array. When I run this application, it displays following error message:
json_decode() expects parameter 1 to be string, object given
How can I fix this error?