use strict; use warnings; use JSON (); use LWP::UserAgent (); use HTTP::Request::Common qw( POST ); use Data::Dumper; my $data = { a => 40, b => 2 }; my $json = JSON->new->utf8->allow_nonref; my $ua = LWP::UserAgent->new; my $req = POST( "$my_url", Content_Type => 'application/json', Content => $json->encode($data), ); my $response = $ua->request($req); if ($response->is_success) { #print Dumper($response->content()); my $perlData = $json->decode($response->content()); print Dumper($perlData); } else{ print " inside falied block\n"; }