use strict;
use warnings;
use JSON qw/ encode_json decode_json /;
my $json = <<'__JSON__';
{
"fields" : {
"customfield_11872" : [
{
"name" : "0.0.0.0",
"self" : "https://localhost.com:8080/rest/api/2/version/35
+372",
"released" : false,
"id" : "35372",
"archived" : false,
"description" : "Null version. May be deleted after other
+conforming versions are created"
}
]
}
}
__JSON__
my $decoded_json = decode_json( $json );
print $decoded_json->{'fields'}{'customfield_11872'}[0]{'name'}, "\n";
use Data::Diver qw/ Dive /;
if( my $toyArrRef = Dive $decoded_json, qw/ fields customfield_11872 /
+ ){
for my $toy ( @{ $toyArrRef } ){
if( my $name = Dive $toy, qw/ name / ){
print "Name is $name\n";
}
}
}
__END__
0.0.0.0
Name is 0.0.0.0
|