php - json_decode to array -
i trying decode json string array following error.
fatal error: cannot use object of type stdclass array in c:\wamp\www\temp\asklaila.php on line 6
here code:
<?php $json_string = 'http://www.domain.com/jsondata.json'; $jsondata = file_get_contents($json_string); $obj = json_decode($jsondata); print_r($obj['result']); ?>
as per the documentation, need specify if want associative array instead of object json_decode
, code:
json_decode($jsondata, true);
Comments
Post a Comment