Welcome Guest, Not a member yet? Register   Sign In
curl->simple_get json
#2

PHP Code:
json_decode(
    string $json,
    ?bool $associative null,
    int $depth 512,
    int $flags 0
): mixed 

associative

When true, JSON objects will be returned as associative arrays; when false, JSON objects will be returned as objects.
When null, JSON objects will be returned as associative arrays or objects depending on whether JSON_OBJECT_AS_ARRAY
is set in the flags.

PHP Code:
// your missing true for the associated array flag.
$data json_decode($this->curl->simple_get('any_json_api_address'));

// should be
$data json_decode($this->curl->simple_get('any_json_api_address'), true); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
curl->simple_get json - by momokaze - 12-07-2022, 01:06 AM
RE: curl->simple_get json - by InsiteFX - 12-09-2022, 12:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB