notes/Google Maps JSON get address-Vrgb5kq5.sh
$webclient = New-Object System.Net.WebClient
$location="Disney"
Write-Output "Getting Address for $location"
$url="https://maps.googleapis.com/maps/api/geocode/json?address=$location"
$json=$webclient.DownloadString($url)
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer
$obj = $ser.DeserializeObject($json)
$item=$obj.Item("results")
$line_break="==============================================\n";
$first=$item.Get(0).formatted_address
Write-Output "$line_break First Entry $first\n$line_break"
Write-Output "$line_break All Entries\n$line_break"
foreach($address in $item){
$address.formatted_address
}
syntax highlighted by Code2HTML, v. 0.9.1