The Extension is working properly but the response is not an array when trying to convert the json data to array.

Here is what I did:

 $ipInfo = new ipInfo ('Mykey', 'json');

                    try {

                    Yii::$app->session['Countryinfo'] = json_decode($ipInfo->getCountry(''));

}catch(Exception $e)


                       Yii::$app->session['Countryinfo'] = null;


 if(Yii::$app->session['Countryinfo'] && count(Yii::$app->session['Countryinfo']['countryCode'])==2){

                          echo 'ok';


I am getting an error saying:

And if I dump :


I get :

Wich shows the value is an object not an array.

I really don’t know what to do.

I’ve tried everything to understand the problem but I don’t see what or how to access those information.