##
my $DATA = {
facts => [
{
name => 'A',
type => 'Normal'
},
{
name => 'B',
type => 'Broken'
}
],
};
print $DATA->{facts}[0]{name}; # A
print $DATA->{facts}[0]{type}; # Normal
####
#!/usr/bin/perl
use warnings;
use strict;
use Cpanel::JSON::XS;
my $DATA = decode_json('{
"facts": [
{
"name": "A",
"type": "Normal"
},
{
"name": "B",
"type": "Broken"
}
]
}');
print $DATA->{facts}[0]{name}; # A
print $DATA->{facts}[0]{type}; # Normal