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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -