title: How to json_decode an array of objects?
body: <p>I have an array of objects. </p>
  
  <pre><code>$arr = array(0 =&gt; o1, 1 =&gt; o2);
  </code></pre>
  
  <p>I get proper json_encode for this. Say, I have:</p>
  
  <pre><code>$json_data = json_encode($arr);
  </code></pre>
  
  <p>BUT, when I <code>json_decode</code> the <code>$json_data</code> variable, 
  with 2nd argument true I get everything in array format:</p>
  
  <pre><code>array(0 =&gt; array, 1 =&gt;array)
  </code></pre>
  
  <p>with 2nd argument false I get everything in object format:</p>
  
  <pre><code>object(0 =&gt; object, 1 =&gt; object)
  </code></pre>
  
  <p>How to get the original array back? I.e. how to get</p>
  
  <pre><code>array(0 =&gt; object, 1 =&gt; object)
  </code></pre>
  
  <p>Edit: paraphrasing my question. When we json_encode an array of objects, how to get back the same array of objects when you json_decode the encoded data?</p>