I have a JSON file like this one (it is a piece of the entire JSON file):
{
id => "mgp1310",
samples => [
{
envPackage => {
data => {
diss_carb_dioxide => {
aliases => ["sediment_diss_carb_dioxide"],
definition => "concentration of dissolved carbon dioxide",
mixs => 1,
required => 0,
type => "text",
unit => "",
value => "17 mM",
},
},
id => "mge64559",
},
},
],
}
This has been decoded by module JSON, using:
use Data::Dumper;
use JSON;
open($fh, '<', 'hola.txt' );
$json_text = <$fh>;
$perl = decode_json($json_text);
print Dumper($perl);
Now I know that $perl
has a hash. So I'd like to print the id
of the JSON file using print $perl{"id"};
. However, it prints nothing I don't know why.