I read the json data like this
That code works for me (Update: assuming the code you showed in the parent node is what produced the output shown in the root node). Please show a representative Short, Self-Contained, Correct Example that reproduces the problem you're having and that includes sample input, expected output, and actual output including any error messages (How do I post a question effectively?).
use warnings;
use strict;
use Data::Dumper;
use JSON::PP qw/decode_json/;
my $json = <<'JSON';
{
"myData" : [
{ "Lang4":"ok", "Lang9":"well", "Lang7":null, "Lang6":null },
{ "Lang4":"one", "Lang9":"two", "Lang7":null, "Lang6":null }
]
}
JSON
my $data = decode_json( $json );
my $definition= $data->{'myData'};
my @definition=@$definition;
print Dumper \@definition;
foreach my $record (@definition) {
print $record->{Lang4}, "\n";
}
Output:
$VAR1 = [
{
'Lang6' => undef,
'Lang9' => 'well',
'Lang4' => 'ok',
'Lang7' => undef
},
{
'Lang6' => undef,
'Lang9' => 'two',
'Lang7' => undef,
'Lang4' => 'one'
}
];
ok
one
|