diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-12-08 17:30:19 +0100 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-12-08 17:30:19 +0100 |
| commit | 6acef1a1d19aa37a92406934db40883e1796bea5 (patch) | |
| tree | fb2aeb51ba14dc5925d13646af673aced628b8f8 /lib/Net/HTTP/API/Parser | |
| parent | allow format_options (diff) | |
| download | net-http-api-6acef1a1d19aa37a92406934db40883e1796bea5.tar.gz | |
pass the format optiosn to the serializers
Diffstat (limited to 'lib/Net/HTTP/API/Parser')
| -rw-r--r-- | lib/Net/HTTP/API/Parser/JSON.pm | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/Net/HTTP/API/Parser/JSON.pm b/lib/Net/HTTP/API/Parser/JSON.pm index 2edc71c..d340c75 100644 --- a/lib/Net/HTTP/API/Parser/JSON.pm +++ b/lib/Net/HTTP/API/Parser/JSON.pm @@ -6,21 +6,14 @@ use JSON; use Moose; extends 'Net::HTTP::API::Parser'; -has _json_parser => ( - is => 'rw', - isa => 'JSON', - lazy => 1, - default => sub { JSON->new->allow_nonref }, -); - sub encode { my ($self, $content) = @_; - $self->_json_parser->encode($content); + JSON::to_json($content, $self->format_options); } sub decode { my ($self, $content) = @_; - $self->_json_parser->decode($content); + JSON::from_json($content, $self->format_options); } 1; |
