title: json_decode can't parse Gmail API json in PHP Laravel
body: <p>Help me please to decode and get <code>access_token</code>.
  Have already checked 30+ stackoverflow posts about <code>json_decode</code></p>
  <p>So first is <code>Curl</code>. These params do not affect json response and decoding: <code>curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'); curl_setopt($ch, CURLOPT_VERBOSE, 1);</code>
  Header output shows it is in utf8 response.</p>
  <ol start="2">
  <li>Checked json online
  <a href="https://i.stack.imgur.com/OfcY5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OfcY5.png" alt="enter image description here" /></a></li>
  </ol>
  <p>It has no &quot;&amp;&quot; or backslashes</p>
  <ol start="3">
  <li><code>$jsonData = curl_exec($ch);</code> and then <code>var_dump($jsonData)</code>-says that Google returned <code>boolean</code></li>
  </ol>
  <p>Here is <code>dd</code> result in Laravel:</p>
  <p><a href="https://i.stack.imgur.com/Cto0J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cto0J.png" alt="enter image description here" /></a></p>
  <p>The code after <code>Curl</code></p>
  <pre><code> .... 
  $jsonData = curl_exec($ch);
  if ($jsonData === null &amp;&amp; json_last_error() !== JSON_ERROR_NONE) {
  echo &quot;json data is incorrect&quot;;
  }
  
  dd(
  var_dump($jsonData),// tell me it is &quot;bool(true)&quot;, after json end}
  'json_decode results:',
  json_decode($jsonData),
  json_decode($jsonData,1),
  json_decode(  ( stripslashes($jsonData) ),1),
  json_decode( trim ( stripslashes($jsonData) ),1),
  json_decode( preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $jsonData), 0 ),
  json_decode( preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $jsonData), 1 )
  );
  </code></pre>
  <p>Also <code>json_decode( trim($jsonData) );</code> not helped</p>