Reputation: 29
I get the following output from an API call:
$json = file_get_contents($service_url);
the var_dump of $json gives me:
string(308) " [{"Transaction_ID":2805579},{"Transaction_ID":2777876},{"Transaction_ID":2808406}]"
However, var_dump(json_decode($json)) returns a null.
What am I doing wrong?
Upvotes: 1
Views: 46
Reputation: 215
See: http://php.net/manual/en/function.json-decode.php
decode_json isn't a function, you should use json_decode
var_dump(json_decode($json))
Upvotes: 1