title: Get a value from JSON: Undefined property: stdClass::$id
body: <p>I am trying to the the "project_id" value from a JSON file, to check with the database if this is unique or not. I will add my code to elaborate on my problem. </p>
  
  <pre><code>$jsonDecode = json_decode(file_get_contents(/path/to/json.json));
  // ERROR OCCURS ON THIS LINE 
  $project_id = $jsonDecode[0]-&gt;project_id;
  
  //      Opening a connection with the database
  $m = new MongoClient();
  $db = $m-&gt;Database;
  $collection = $db-&gt;test;
  
  //      Find a document with the same Project ID
  $cursor = $collection-&gt;findOne(array("project_id" =&gt; $project_id));
  </code></pre>
  
  <p>My JSON is formatted like this: </p>
  
  <pre><code>[{"project_id": 66, "project_code": 14070169, "nr_samples": 96, "samples": [{EMBEDDED DOCUMENT WITH DATA}, {EMBEDDED DOCUMENT WITH DATA}, ..... GOES ON FOR A LONG TIME}]
  </code></pre>
  
  <p>The specifc error which I am getting is: </p>
  
  <blockquote>
    <p>ErrorException in UploadExcelFileController.php line 340: Undefined
    property: stdClass::$project_id</p>
  </blockquote>
  
  <p>I don't understand what is going wrong here, because I am using the same code for a similar formatted JSON file and that works great! Could someone please help me out? I just want to get the value of "project_id" to query. </p>
  
  <p><strong>UPDATE...</strong></p>
  
  <p>Wow. I am so embarrassed. The file didn't contain a project_id key.. I was looking at the wrong JSON file. So now the code works. I am sorry! </p>