I'm reading a json file in perl and having trouble using the results.
I want to know how many views are present in the json file. there should be 2
my $data = decode_json($json);
print Dumper($data);
my @tmp=$data->{'views'};
my $nviews=scalar @tmp;
print "nviews : $nviews\n";
gives me
$VAR1 = {
'views' => [
{
'key' => 0,
'value' => {
'ptr_wrapper' => {
'data' => {
'width' => 776,
'height' => 1024,
'id_view' => 0,
'filename' => '000118800_15821618907.jpg',
'id_pose' => 0,
'id_intrinsic' => 13,
'local_path' => '/'
},
'id' => 2147483649
}
}
},
{
'key' => 1,
'value' => {
'ptr_wrapper' => {
'data' => {
'id_pose' => 1,
'id_intrinsic' => 11,
'filename' => '000132800_22050281512.jpg',
'id_view' => 1,
'local_path' => '/',
'width' => 850,
'height' => 1024
},
'id' => 2147483650
}
}
}
]
};
nviews : 1
thanks in advance for any help.luc