title: Problems decoding returned JSON data as an object
body: <p>Im not sure how to exactly get values (access objects and show them on page, or store as variables, etc. just I want to get those IDs (9473, 5649, 7953 .......) from JSON output.</p>
  
  <p>Adding the URL which I am decoding, so you can take a look at it, cos Im really confused. Either I got undefined strClass or non-object error :/</p>
  
  <p>The source API URL is:</p>
  
  <pre><code>api.worldoftanks.eu/wot/account/tanks/?application_id=demo&amp;fields=tank_id&amp;account_id=503066565
  </code></pre>
  
  <p>Function to get content from URL:</p>
  
  <pre><code>function get_url_contents($url){
      $crl = curl_init();
      $timeout = 5;
      curl_setopt ($crl, CURLOPT_URL,$url);
      curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
      $ret = curl_exec($crl);
      curl_close($crl);
      return $ret;
  }
  </code></pre>
  
  <p>This is print of JSON return I get (1, 2 ......... 89):</p>
  
  <pre><code>stdClass Object
  (
      [status] =&gt; ok
      [count] =&gt; 1
      [data] =&gt; stdClass Object
          (
              [503066565] =&gt; Array
                  (
                      [0] =&gt; stdClass Object
                          (
                              [tank_id] =&gt; 9473
                          )
  
                      [1] =&gt; stdClass Object
                          (
                              [tank_id] =&gt; 5649
                          )
  
                      [2] =&gt; stdClass Object
                          (
                              [tank_id] =&gt; 7953
                          )
                      [89] =&gt; stdClass Object
                          (
                              [tank_id] =&gt; 64817
                          )
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p>This is raw JSON output (its much longer, but its mainly same, just more tank_ids there):</p>
  
  <pre><code>{"status":"ok","count":1,"data":{"503066565":[{"tank_id":9473},{"tank_id":5649},{"tank_id":7953},{"tank_id":64817}]}}
  </code></pre>
  
  <p>I tried to get data from it in couple of ways, but problem is, that ID (503066565) is Array and every time I get error about non-object data or Undefined property: stdClass:</p>
  
  <p>Im used to get data from JSON when there is no array, so Im little bit confused now.</p>
  
  <p>Also I use PHP.</p>
  
  <p>Commented code is sample of things I tried (and I tried like 20 possible options that came to my mind), but I dont work with JSON output often, so I need your help.</p>
  
  <pre><code>$wg_id = "503066565";
  $wot = json_decode(get_url_contents("URL"));
  //$tank_id = $wot-&gt;data-&gt;$wg_id-&gt;in_garage;
  /*
  $tank_id = $wot-&gt;data-&gt;$wg_id['in_garage'];
  foreach ($wot as $i){
      echo $i['tank_id'];
  }
  */
  echo $tank_id;
  </code></pre>
  
  <p>How can I get all those data out (maybe to array)? I need them to compare those IDs when selecting stuff from DB. Also there might be another value in_garage, is there option to add it to array and know which values are together (you know, each in_garage is for specific tank_id).</p>