Hi,
I'm using Google Maps API to get location information for a lat, long and produce the following JSON (identifying information removed):
{
"plus_code" : {
"compound_code" : "XXX",
"global_code" : "XXX"
},
"results" : [
{
"address_components" : [
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "premise" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "street_number" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "route" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "postal_town" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "country", "political" ]
},
{
"long_name" : "XXX",
"short_name" : "XXX",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "XXX",
"geometry" : {
"location" : {
"lat" : XXX,
"lng" : XXX },
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : XXX,
"lng" : XXX},
"southwest" : {
"lat" : XXX,
"lng" : XXX}
}
},
"place_id" : "XXX",
"plus_code" : {
"compound_code" : "XXX",
"global_code" : "XXX"
},
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
I use AutoTools Json Read with the following settings to filter out, for example, the long_name for premise:
What I am having trouble doing is using it to pull out administrative_area_level_2 or administrative_area_level_1. I think my problem is because there are two types for these - "administrative_area_level_1" and "political" but I can't work out how to filter it correctly.
Is anyone able to help me please?