IB2017 has asked for the wisdom of the Perl Monks concerning the following question:
Hello
I send data to a cgi-bin script in JSON format using JSON::PP
my $url= $Server . "/cgi-bin/DB_NewTerm.pl"; my $data = { record => \@record}; my $request = POST($url, Content_Type=>'application/json', Content => encode_json($data) ); my $response = $ua->request($request); print $response->content, "\n";
One of the element of my @record is a date. And here seems to be the problem, since I get the following error:
Tk::Error: encountered object '2019-12-23', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing)Why is this data considered an issue?
Edit
This produces the error:
my @record=( $Tag1, $Tag2, $CommentAll, $today );
However, the following does not:
my @record=( $Tag1, $Tag2, $CommentAll, "$today" );
(Being $date the variable containing the date)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Json::PP data error
by stevieb (Canon) on Dec 23, 2019 at 22:47 UTC | |
by IB2017 (Pilgrim) on Dec 23, 2019 at 22:58 UTC | |
by davido (Cardinal) on Dec 24, 2019 at 04:48 UTC |