title: Accessing JSON properties
body: <p>I'm using a location API and would like to <strong>access the <code>adminArea1</code> value</strong>, so that I can store the country in a JavaScript variable. How would I access that value in this case? I already know how to import this JSON to JavaScript (as an object), so that is no problem. The object is called <code>locationResults</code>.</p>
  
  <pre><code>{
      "results": [{
          "locations": [{
              "latLng": {
                  "lng": -76.329999,
                  "lat": 40.0755
              },
              "adminArea4": "Lancaster County",
              "adminArea5Type": "City",
              "adminArea4Type": "County",
              "adminArea5": "Lancaster",
              "street": "Granite Run Drive",
              "adminArea1": "US", //THE VALUE I WANT
              "adminArea3": "PA",
              "type": "s",
              "displayLatLng": {
                  "lng": -76.333129,
                  "lat": 40.07657
              },
              "linkId": 0,
              "postalCode": "17601",
              "sideOfStreet": "N",
              "dragPoint": false,
              "adminArea1Type": "Country",
              "geocodeQuality": "ADDRESS",
              "geocodeQualityCode": "L1AAA",
              "mapUrl": "http://open.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luur2du2n1,bn=o5-9ar2l0&amp;type=map&amp;size=225,160&amp;pois=purple-1,40.0755,-76.329999,0,0|&amp;center=40.0755,-76.329999&amp;zoom=15&amp;rand=-320722776",
              "adminArea3Type": "State"
          }],
          "providedLocation": {
              "latLng": {
                  "lng": -76.329999,
                  "lat": 40.0755
              }
          }
      }],
      "options": {
          "ignoreLatLngInput": false,
          "maxResults": -1,
          "thumbMaps": true
      },
      "info": {
          "copyright": {
              "text": "© 2014 MapQuest, Inc.",
              "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
              "imageAltText": "© 2014 MapQuest, Inc."
          },
          "statuscode": 0,
          "messages": []
      }
  }
  </code></pre>
  
  <p>Using the following:</p>
  
  <pre><code>$.getJSON(reverseGeoRequestURL, function(reverseGeoResult){
      window.country = reverseGeoResult.results[0].adminArea1;
      console.log(window.country);
  });
  </code></pre>
  
  <p>Gives the console output "<strong>undefined</strong>".</p>
  
  <h1>Solution</h1>
  
  <p>This JSON sure is messy! I figured out how to get to the value:</p>
  
  <p><code>locationResults.results[0].locations[0].adminArea1;</code></p>