user476918 user476918 - 13 days ago 4
Perl Question

JSON string and PERL

How can I read a JSON string like this without "headers":


my $json = JSON->new->utf8;
my $perl_data = $json->decode($content);
print ref($perl_data) . "\n";

returns ARRAY. I would like each element.



There is an array ref around the hash references. You need to iterate over the array reference to get each element.

use Data::Dumper;

foreach my $elem (@{ $perl_data }) {
    print Dumper $elem;