1

I was using HTTP::Daemon to create a http server for my API. With the help of following example and doc, I was able to create a basic HTTP server.

However, my API should accepts JSON as a body in post request to the server. So, I need to read the JSON so that I can process it. I know, how to read url param $r->uri->query_form();

Is there a way to read POST JSON?

Community
  • 1
  • 1
Ritesh Kumar Gupta
  • 5,055
  • 7
  • 45
  • 71

1 Answers1

3
use JSON;
use Data::Dumper;
my $json = decode_json($r->content);
print Dumper $json;
Scriptkiddy1337
  • 792
  • 4
  • 9