http://www.perlmonks.org?node_id=1017357


in reply to Re^3: Getting error while decoding JSON object via POST method
in thread Getting error while decoding JSON object via POST method

mo luck!! tried like this:
my $inData = { "name" => "test", "id" => "test", "test" => [1,2,3,4],} +; my $json = JSON->new->utf8->allow_nonref; my $jsonData = $json->encode($inData); print Dumper($jsonData); ##Output of dumper : $VAR1 = '{"test":[1,2,3,4],"name":"test","id":"test"}'; # post set post request my $req = HTTP::Request->new('POST', $rest_url); $req->content($jsonData); my $response = $iua->request($req);
getting same error.

Replies are listed 'Best First'.
Re^5: Getting error while decoding JSON object via POST method
by Corion (Patriarch) on Feb 06, 2013 at 09:01 UTC

    Where did you try what?

    I think that you are either not sending the data you think you're sending, or you're not receiving the data you think you're receiving. You have not shown working, self-contained code that exhibits the problem, so it's hard to replicate your problem or to understand what you're doing wrong.

    If you want to investigate this further, I suggest printing the values you get in the request to a log file on the receiving end.