code: public function actionView($id,$format= false)
      {
          $model = $this->findModel($id);
          
          if ($format == 'json')
          {
  			return \yii\helpers\Json::encode($model);	
  		}
  		else
  		{
  			return $this->render('view', [
  				'model' => $model,
  			]);
  		}        
      }
docs: Displays a single Post model.
  @param integer $id
  @additionalParam string $format
  @return mixed