Hi, I am using the Google Places API and would like to extract some information and write it to a table.
I would like to save the address in a table of 'service providers'. The concept of what is a city differs hugely when looking at a global level. So I would like to store the administrative_area_levels, als Google calls them.
I thought of storing them as an object.
The response contains this:
[
{
'long_name': 'Jalan Munduk Tengah',
'short_name': 'Jl. Munduk Tengah',
'types': ['route']
},
{
'long_name': 'Kabupaten Badung',
'short_name': 'Kabupaten Badung',
'types': ['administrative_area_level_2', 'political']
},
{
'long_name': 'Bali',
'short_name': 'Bali',
'types': ['administrative_area_level_1', 'political']
},
{
'long_name': '80351',
'short_name': '80351',
'types': ['postal_code']
}]
I would like to transform and save it like this:
{
'administrative_area_level_1': 'Bali',
'administrative_area_level_2': 'Kabupaten Badung',
'administrative_area_level_3': 'Kecamatan Mengwi'
}
Unfortunately I tried many filters and functions but couldn't get it done-