title: Extract access token from JSON
body: <p>I'm receiving some authentication details via an API and they are being returned as JSON. I am trying to extract the "access token" part to be used in another request.</p>
  
  <p>The result of my cURL request is:</p>
  
  <pre><code>{"token_type":"bearer","access_token":"AAAAAAAAAAAAAAAAAAAAAMVfbQAAAAAAK7qYRQOgdZ771TrJ6pZ7nugCwVQ%3DLKcongtwy3lcBDbPSEreC9DfhJk3Gm7qyQInqhFAxYvo1clv4S"}
  </code></pre>
  
  <p>I'm trying to get just the access token from this:</p>
  
  <pre><code>json_decode($result, true);
  $token = $response['access_token'];
  var_dump($token);
  </code></pre>
  
  <p>But the result is always <code>NULL</code></p>
  
  <p>I have also tried to convert the JSON to a string so I can extract it using some sort of regex but cannot get it to return anything except <code>NULL</code></p>