in reply to Re: Parsing a JSON response
in thread Parsing a JSON response

I don't yet follow you but I am hanging on with everything I have.

If both "address_components' AND 'types' are keys within the same hash, then what is the value pair for 'address_components'? I'm having trouble wrapping my head around that... Indeed, I thought types was a substructure within 'address_components'...

Replies are listed 'Best First'.
Re^3: Parsing a JSON response
by Anonymous Monk on Jul 25, 2014 at 23:42 UTC

    Does this rehohy output help?

    my $VAR1; $VAR1->{formatted_address} = "Johannesburg, South Africa"; #d0 $VAR1->{types}[0] = "locality"; #d1 $VAR1->{types}[1] = "political"; #d1 $VAR1->{address_components}[0]{types}[0] = "locality"; #d3 $VAR1->{address_components}[0]{types}[1] = "political"; #d3 $VAR1->{address_components}[0]{short_name} = "Johannesburg"; #d2 $VAR1->{address_components}[0]{long_name} = "Johannesburg"; #d2 $VAR1->{address_components}[1]{types}[0] = "administrative_area_level_3"; #d3 $VAR1->{address_components}[1]{types}[1] = "political"; #d3 $VAR1->{address_components}[1]{short_name} = "Johannesburg"; #d2 $VAR1->{address_components}[1]{long_name} = "Johannesburg"; #d2 $VAR1->{address_components}[2]{types}[0] = "administrative_area_level_2"; #d3 $VAR1->{address_components}[2]{types}[1] = "political"; #d3 $VAR1->{address_components}[2]{short_name} = "City of Johannesburg Metropolitan Municipality"; #d2 $VAR1->{address_components}[2]{long_name} = "City of Johannesburg Metropolitan Municipality"; #d2 $VAR1->{address_components}[3]{types}[0] = "administrative_area_level_1"; #d3 $VAR1->{address_components}[3]{types}[1] = "political"; #d3 $VAR1->{address_components}[3]{short_name} = "GP"; #d2 $VAR1->{address_components}[3]{long_name} = "Gauteng"; #d2 $VAR1->{address_components}[4]{types}[0] = "country"; #d3 $VAR1->{address_components}[4]{types}[1] = "political"; #d3 $VAR1->{address_components}[4]{short_name} = "ZA"; #d2 $VAR1->{address_components}[4]{long_name} = "South Africa"; #d2 $VAR1->{geometry}{viewport}{southwest}{lat} = -26.2389231; #d3 $VAR1->{geometry}{viewport}{southwest}{lng} = 27.942449; #d3 $VAR1->{geometry}{viewport}{northeast}{lat} = -26.1041199; #d3 $VAR1->{geometry}{viewport}{northeast}{lng} = 28.1376001; #d3 $VAR1->{geometry}{location}{lat} = -26.2041028; #d2 $VAR1->{geometry}{location}{lng} = 28.0473051; #d2 $VAR1->{geometry}{location_type} = "APPROXIMATE"; #d1 $VAR1->{geometry}{bounds}{southwest}{lat} = -26.2389231; #d3 $VAR1->{geometry}{bounds}{southwest}{lng} = 27.942449; #d3 $VAR1->{geometry}{bounds}{northeast}{lat} = -26.1041199; #d3 $VAR1->{geometry}{bounds}{northeast}{lng} = 28.1376001; #d3

    See also references quick reference

    see also

    chromatics free book Modern Perl a loose description of how experienced and effective Perl 5 programmers work....You can learn this too.
    Learn Perl in about 2 hours 30 minutes

      Yes... and no. I have to study this. I may be thinking a bit too old-fashioned - a 2D array but more like rows and columns (not in any particular order). Thanks for the help - I have my homework to do!