user1849286
user1849286

Reputation: 179

What modules to use for Perl Client to API which uses JSON-RPC protocol?

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

Answers (1)

creaktive
creaktive

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

Related Questions