title: How to decode json string into half array/ half object?
body: <p>I have the following json string</p>
  
  <pre><code>$str = '{"icwsCallQueue":{"1002598152":{"AccoRDI_account_id":"","AccoRDI_mid":"","Eic_CallDirection":"O","Eic_CallIdKey":"100259815260150624","Eic_CallState":"Disconnected","Eic_ConferenceId":"","Eic_ConferenceMembers":"","Eic_ImmediateAccess":"1","Eic_LocalName":"Full Name","Eic_LocalUserId":"username","Eic_MonitorsCombinedCount":"0","Eic_Muted":"","Eic_ObjectType":"Call","Eic_ParentConferenceId":"","Eic_RemoteAddress":"307","Eic_RemoteName":"username-test","Eic_State":"I"},"1002598162":{"AccoRDI_account_id":"","AccoRDI_mid":"","Eic_CallDirection":"O","Eic_CallIdKey":"100259816260150624","Eic_CallState":"Disconnected","Eic_ConferenceId":"","Eic_ConferenceMembers":"","Eic_ImmediateAccess":"1","Eic_LocalName":"Full Name","Eic_LocalUserId":"username","Eic_MonitorsCombinedCount":"0","Eic_Muted":"","Eic_ObjectType":"Call","Eic_ParentConferenceId":"","Eic_RemoteAddress":"307","Eic_RemoteName":"username-test","Eic_State":"I"}}}';
  </code></pre>
  
  <p>If I decode it using <code>json_decode($str)</code>
  I get the following</p>
  
  <pre><code>stdClass Object
  (
      [icwsCallQueue] =&gt; stdClass Object
          (
              [1002598152] =&gt; stdClass Object
                  (
                      [AccoRDI_account_id] =&gt; 
                      [AccoRDI_mid] =&gt; 
                      [Eic_CallDirection] =&gt; O
                      [Eic_CallIdKey] =&gt; 100259815260150624
                      [Eic_CallState] =&gt; Disconnected
                      [Eic_ConferenceId] =&gt; 
                      [Eic_ConferenceMembers] =&gt; 
                      [Eic_ImmediateAccess] =&gt; 1
                      [Eic_LocalName] =&gt; Full Name
                      [Eic_LocalUserId] =&gt; username
                      [Eic_MonitorsCombinedCount] =&gt; 0
                      [Eic_Muted] =&gt; 
                      [Eic_ObjectType] =&gt; Call
                      [Eic_ParentConferenceId] =&gt; 
                      [Eic_RemoteAddress] =&gt; 307
                      [Eic_RemoteName] =&gt; username-test
                      [Eic_State] =&gt; I
                  )
  
              [1002598162] =&gt; stdClass Object
                  (
                      [AccoRDI_account_id] =&gt; 
                      [AccoRDI_mid] =&gt; 
                      [Eic_CallDirection] =&gt; O
                      [Eic_CallIdKey] =&gt; 100259816260150624
                      [Eic_CallState] =&gt; Disconnected
                      [Eic_ConferenceId] =&gt; 
                      [Eic_ConferenceMembers] =&gt; 
                      [Eic_ImmediateAccess] =&gt; 1
                      [Eic_LocalName] =&gt; Full Name
                      [Eic_LocalUserId] =&gt; username
                      [Eic_MonitorsCombinedCount] =&gt; 0
                      [Eic_Muted] =&gt; 
                      [Eic_ObjectType] =&gt; Call
                      [Eic_ParentConferenceId] =&gt; 
                      [Eic_RemoteAddress] =&gt; 307
                      [Eic_RemoteName] =&gt; username-test
                      [Eic_State] =&gt; I
                  )
  
          )
  
  )
  </code></pre>
  
  <p>The problem with this is that I can't access a property with only an integer. I can't do this <code>$icwsCallQueue-&gt;100259152-&gt;Eic_State</code>
  so what I need to do some how is convert my decoded string to something like this</p>
  
  <pre><code>stdClass Object
  (
      [icwsCallQueue] =&gt; Array
          (
              [1002598152] =&gt; stdClass Object
                  (
                      [AccoRDI_account_id] =&gt; 
                      [AccoRDI_mid] =&gt; 
                      [Eic_CallDirection] =&gt; O
                      [Eic_CallIdKey] =&gt; 100259815260150624
                      [Eic_CallState] =&gt; Disconnected
                      [Eic_ConferenceId] =&gt; 
                      [Eic_ConferenceMembers] =&gt; 
                      [Eic_ImmediateAccess] =&gt; 1
                      [Eic_LocalName] =&gt; Full Name
                      [Eic_LocalUserId] =&gt; username
                      [Eic_MonitorsCombinedCount] =&gt; 0
                      [Eic_Muted] =&gt; 
                      [Eic_ObjectType] =&gt; Call
                      [Eic_ParentConferenceId] =&gt; 
                      [Eic_RemoteAddress] =&gt; 307
                      [Eic_RemoteName] =&gt; username-test
                      [Eic_State] =&gt; I
                  )
  
              [1002598162] =&gt; stdClass Object
                  (
                      [AccoRDI_account_id] =&gt; 
                      [AccoRDI_mid] =&gt; 
                      [Eic_CallDirection] =&gt; O
                      [Eic_CallIdKey] =&gt; 100259816260150624
                      [Eic_CallState] =&gt; Disconnected
                      [Eic_ConferenceId] =&gt; 
                      [Eic_ConferenceMembers] =&gt; 
                      [Eic_ImmediateAccess] =&gt; 1
                      [Eic_LocalName] =&gt; Full Name
                      [Eic_LocalUserId] =&gt; username
                      [Eic_MonitorsCombinedCount] =&gt; 0
                      [Eic_Muted] =&gt; 
                      [Eic_ObjectType] =&gt; Call
                      [Eic_ParentConferenceId] =&gt; 
                      [Eic_RemoteAddress] =&gt; 307
                      [Eic_RemoteName] =&gt; username-test
                      [Eic_State] =&gt; I
                  )
  
          )
  
  )
  </code></pre>
  
  <p>so I can access the records like this <code>$icwsCallQueue['100259152']-&gt;Eic_State</code></p>
  
  <p>on the other hand if I decoded the string like this <code>json_decode($str, true)</code> everything will be presented as array which is not what am I looking for.</p>
  
  <p>Any idea on how to decode the string with array when array must be used and object when array can be avoided?</p>