Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catchable fatal error: Object of class stdClass could not be converted to string

Tags:

json

php

I am converting an array to json from php json_encode(). If I encode it for one array I can decode it, but when it is like this:array('a'=>array(0=>array(),1=>array())) it returns {"a":[[],[]]}

When I decode it I get the following error

Catchable fatal error: Object of class stdClass could not be converted to string

json source

the json is here

like image 705
rohitarora Avatar asked Dec 15 '22 14:12

rohitarora


1 Answers

use true as second parameter in json_decode

$arr = json_decode($your_array,true); // it will create array

working example http://codepad.viper-7.com/0Dxxm8

like image 166
Yogesh Suthar Avatar answered Jan 18 '23 23:01

Yogesh Suthar