I'm having problems getting data from JSON with PHP.
json string
{"cpresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}
Same json decoded
array (
'cpresult' =>
array (
'apiversion' => '2',
'error' => 'Access denied',
'data' =>
array (
'reason' => 'Access denied',
'result' => '0',
),
'type' => 'text',
),
)
PHP code
$get_accounts = json_decode($get_accounts);
echo $get_accounts['cpresult']['data'][0]['result'];
error: Fatal error: Cannot use object of type stdClass as array