I am trying to loop through a JSON string using a foreach()
. However I keep getting the following error:
"Notice: Trying to get property of non-object".
The strange part is that when I copy and paste the JSON string and then run the foreach()
, it work fine. Just to provide some detail, I am using the Best-Buy API.
Since this seemed to work fine for everyone here is it possible there is something wrong with the data that best buy is feeding me?
Please help, I have tried everything!
UPDATE sorry for not posting code. here it is:
$info = json_decode($test, true);
function tagGen($info){
foreach($info as $key => $value){
}