title: Decoding JSON in PHP can't access keys
body: <p>I have the JSON result:</p>
  
  <pre><code>[ { "_id" : { "$oid" : "5237d438e4b07666dcca4896"} , 
      "username" : "user" , "password" : "asdf"} ]
  </code></pre>
  
  <p>That is returned from a GET request. I am trying to decode this result, I can't seem to access the username or password keys. This is what I tried:</p>
  
  <pre><code>$obj = json_decode($result[0]);
  echo $obj-&gt;username;
  </code></pre>
  
  <p>However it seems to return the entire result(the array) every time. </p>