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