From Google API I have such JSON returned and I need to extract location:lat and location:lng
(On macOS)
What is the quickest way (least lines of code) to parse out these two location coordinates?
{
"results" : [
{
"address_components" : [
{
"long_name" : "Kleinlützel",
"short_name" : "Kleinlützel",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Thierstein District",
"short_name" : "Thierstein District",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Solothurn",
"short_name" : "SO",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Switzerland",
"short_name" : "CH",
"types" : [ "country", "political" ]
},
{
"long_name" : "4245",
"short_name" : "4245",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "4245 Kleinlützel, Switzerland",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 47.4462799,
"lng" : 7.4555199
},
"southwest" : {
"lat" : 47.41085990000001,
"lng" : 7.37591
}
},
"location" : {
"lat" : 47.4254097,
"lng" : 7.418513299999999
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 47.4462799,
"lng" : 7.4555199
},
"southwest" : {
"lat" : 47.41085990000001,
"lng" : 7.37591
}
}
},
"partial_match" : true,
"place_id" : "ChIJi4OsKhLCkUcR6iZHghxqLyM",
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}