diff --git a/Build.PL b/Build.PL index ce30bc0..5971e39 100644 --- a/Build.PL +++ b/Build.PL @@ -7,7 +7,7 @@ my $builder = Module::Build->new( requires => { 'Config::Tiny' => 0, 'IO::Socket::SSL' => 0, - 'JSON' => 0, + 'JSON::XS' => 0, 'LWP::UserAgent' => 0, 'Readonly' => 0, }, diff --git a/lib/NGCP/API/Client.pm b/lib/NGCP/API/Client.pm index 88c8d20..3a1d47d 100644 --- a/lib/NGCP/API/Client.pm +++ b/lib/NGCP/API/Client.pm @@ -3,11 +3,10 @@ use strict; use warnings; use English qw(-no_match_vars); use Config::Tiny; -use JSON qw(to_json); +use JSON::XS; use IO::Socket::SSL; use LWP::UserAgent; use Readonly; -use Encode; use URI; my $config; @@ -96,7 +95,7 @@ sub request { my $req = $self->_create_req($method, $self->_get_url($urlbase,$uri)); if ($data) { - $req->content(Encode::encode_utf8(to_json($data))); + $req->content(encode_json($data)); } my $res = $ua->request($req); @@ -165,7 +164,7 @@ use warnings; use strict; use parent qw(HTTP::Response); -use JSON qw(from_json); +use JSON::XS; sub new { my ($class, $res_obj) = @_; @@ -180,7 +179,7 @@ sub new { sub as_hash { my $self = shift; return $self->{_cached} if $self->{_cached}; - $self->{_cached} = from_json($self->content, { utf8 => 1 }); + $self->{_cached} = decode_json($self->content); return $self->{_cached}; }