use warnings; use strict; use Data::Dumper; use JSON; my $today = '2019-12-23'; my @array = ($today); my $j = encode_json \@array; my $p = decode_json $j; print Dumper $p; #### my $today = DateTime->now; #### encountered object '2019-12-23T22:45:49', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at date.pl line 12.