I am using google maps API geocoding service to get location's country name, postal code etc.
JSON response:
{
  "name": "1600 Amphitheatre Parkway, Mountain View, CA, USA",
  "Status": {
    "code": 200,
    "request": "geocode"
  },
  "Placemark": [
    {
      "address": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
      "AddressDetails": {
        "Country": {
          "CountryNameCode": "US",
          "AdministrativeArea": {
            "AdministrativeAreaName": "CA",
            "SubAdministrativeArea": {
              "SubAdministrativeAreaName": "Santa Clara",
              "Locality": {
                "LocalityName": "Mountain View",
                "Thoroughfare": {
                  "ThoroughfareName": "1600 Amphitheatre Pkwy"
                },
                "PostalCode": {
                  "PostalCodeNumber": "94043"
                }
              }
            }
          }
        },
        "Accuracy": 8
      },
      "Point": {
        "coordinates": [-122.083739, 37.423021, 0]
      }
    }
  ]
}
Here is the problem - sometimes (despite checking for undefined) I get an error that country is undefined.
var country = document.getElementById("id_country");
if(place.AddressDetails.Country.CountryNameCode != undefined){
    country.value = place.AddressDetails.Country.CountryNameCode;
}
Also how can I access PostalCodeNumber?
place.AddressDetails.AdministrativeArea.SubAdministrativeArea.PostalCode.PostalCodeNumber