in reply to Re^2: write_file to_json in Dancer app
in thread write_file to_json in Dancer app
updating the code between the comment lines to the code I mention below makes that the data is been written to a 'json' file.
Not very clever code yet as the data gets overwritten every time you run the script but that is a separate issue.
#-------v this does work --------# my $filename = "testme.json"; my $json = -e $filename ? read_file $filename : '{}'; my $data = from_json $json; $data = \@photos; write_file $filename, to_json($data);
In Section
Seekers of Perl Wisdom