in reply to Parsing a JSON response

To clarify, you are not parsing a JSON response, you are using a Perl data structure returned by the module. There no JSON handling in your code and it’s irrelevant to what you’re doing whether or not Geo::Coder::Google does so under the hood. I also think this is closer to the kind of approach you want than assuming data positions will remain immutable–

my $location = $geocoder->geocode(location => "STRING"); for my $component ( @{ $location->{address_components} } ) { next unless grep $_ eq "country", @{$component->{types}}; print $component->{long_name}, $/; }

Replies are listed 'Best First'.
Re^2: Parsing a JSON response
by mcoblentz (Scribe) on Jul 25, 2014 at 19:30 UTC
    Yes, thanks for the correction - I'm just parsing the data structure created by the module - I'm not doing it myself. And thanks for the tip on the structures as the positions are indeed not immutable. I will study this. Thanks for the help!