use JSON::PP; my $json = JSON::PP->new; my $json_output=encode_json( { JSON1=> \@my_A } ); print $json_output;