When using PHP's json_decode()
, I don't see a way to distinguish between a NULL
return value indicating a failure in decoding and a correctly decoded NULL
value:
var_dump(json_decode('nonsense')); // returns NULL
var_dump(json_decode(json_encode(NULL))); // also returns NULL
And case one doesn't throw an exception. So I'm not sure how to test for a decode failure.
Ideas?