Reputation: 179
I am looking to develop a perl client to an API which uses JSON-RPC. What are the best modules to use for this? Is using Mojolicious possible/ efficient?
Upvotes: 2
Views: 123
Reputation: 5220
Mojolicious has very nice JSON encoding/decoding, while the following sample isn't exactly JSON-RPC, it's trivial to make it fully compliant:
post '/prefetch' => sub {
my ($self) = @_;
my $post = $self->req->json;
my %row;
for my $key (qw(country state city district suburb address number complement latitude longitude)) {
$row{$key} = $post->{$key} if exists $post->{$key};
}
Upvotes: 2