I have an array of hashes that I would like to convert into an un-named JSON array.
If I have an array of hashes which I then try to encode to JSON as such:
my @labs = ();
push (@labs, {id=>'1', title=>'Lab1'});
push (@labs, {id=>'2', title=>'Lab2'});
my $json_text = to_json {\@labs}, {ascii=>1, pretty => 1};
then the resulting JSON looks like:
{
"ARRAY(0x358a18)" : null
}
when in fact I want it to look like:
[
{"title" : "Lab1", "id" : "1"},
{"title" : "Lab2", "id" : "2"}
]