title: How to access JSON object without knowing its name (and that is not in an array)
body: <p>My problem is rather simple, at least I hope so, but I just cannot find the solution. I have a JSON string, which I got from a get request to a server.</p>
  
  <p>Exemple of my JSON :</p>
  
  <pre><code>"body":[
  {
     "_id":"70:ee:50:05:00:aa",
     "place":{
        "location":[
           2.4358958,
           49.503012
        ],
        "altitude":89,
        "timezone":"Europe/Paris"
     },
     "mark":8,
     "measures":{
        "02:00:00:04:f8:6a":{
           "res":{
              "1431926951":[
                 7.9,
                 83
              ]
           },
        "type":[
           "temperature",
           "humidity"
           ]
        },
        "70:ee:50:05:00:aa":{
           "res":{
              "1431932787":[
                 1009.4
              ]
           },
           "type":[
              "pressure"
           ]
        }
    },
    "modules":[
       "02:00:00:04:f8:6a"
    ]
  },
  </code></pre>
  
  <p>I need to accessthe temperature value, so following this example I would do this :                <code>$value = body-&gt;measures-&gt;02:00:00:04:f8:6a-&gt;res-&gt;1431926951[0].</code></p>
  
  <p>I know i can't just do this : <code>measures-&gt;02:00:00:04:f8:6a</code>. The cool thing is that this difficulty can be solved doing this : <code>$module = body-&gt;modules[0]</code> and then I can use this variable.
  So it would look like this : <code>body-&gt;measures-&gt;$module-&gt;res-&gt;1431926951[0].</code></p>
  
  <p>What I can't seem to do though is the final step : <code>res-&gt;1431926951[0]</code>. This number seem completely random I can't find this value anywhere else in the JSON so I can't use the same trick I did for <code>02:00:00:04:f8:6a.</code> 
  So my question is how can I access the first value of the array located inside the object "<strong>1431926951</strong>" without knowing its name ?</p>
  
  <p>Thank you very much for taking the time to help me.</p>
  
  <p>EDIT : here is the code I am using in PHP</p>
  
  <pre><code>$results = json_decode($resp);
  foreach($results-&gt;body as $result){
      $id = $result-&gt;_id;
      $lat = $result-&gt;place-&gt;location[0];
      $lng = $result-&gt;place-&gt;location[1];
      $module = $result-&gt;modules[0];
      $type = $result-&gt;measures-&gt;$module-&gt;type[0];
      $value = "1431926951";
      //$test = $result-&gt;measures-&gt;$module-&gt;res-&gt;$value[0];
      /*$res = $result-&gt;measures[$result-&gt;measures[0]]-&gt;res;
      $test = $res[Object.keys($res)[0]][0];*/
      echo 'Id: '.$id.' - Lat: '.$lat.' - Lng: '.$lng.' - test: '.$test."&lt;br&gt;";
  }
  </code></pre>