X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStorage%2FFormat%2FJSON.pm;h=d926bcf9514c18eb283a0e821b7d7ddb5fc56a01;hb=d3671a48f9673b8f5e74f9105b56406e4bfe5a6b;hp=44e00fa9f7de7b6d59ba86f5d7d7c8e7b6c61fb4;hpb=ec72518379c644ab85126ee0391773ee7028665c;p=gitmo%2FMooseX-Storage.git diff --git a/lib/MooseX/Storage/Format/JSON.pm b/lib/MooseX/Storage/Format/JSON.pm index 44e00fa..d926bcf 100644 --- a/lib/MooseX/Storage/Format/JSON.pm +++ b/lib/MooseX/Storage/Format/JSON.pm @@ -1,4 +1,3 @@ - package MooseX::Storage::Format::JSON; use Moose::Role; @@ -7,25 +6,24 @@ no warnings 'once'; use JSON::Any; use utf8 (); -our $VERSION = '0.18'; -our $AUTHORITY = 'cpan:STEVAN'; - requires 'pack'; requires 'unpack'; sub thaw { my ( $class, $json, @args ) = @_; utf8::encode($json) if utf8::is_utf8($json); - $class->unpack( JSON::Any->jsonToObj($json), @args ); + $class->unpack( JSON::Any->new->jsonToObj($json), @args ); } sub freeze { my ( $self, @args ) = @_; - my $json = JSON::Any->objToJson( $self->pack(@args) ); + my $json = JSON::Any->new(canonical => 1)->objToJson( $self->pack(@args) ); utf8::decode($json) if !utf8::is_utf8($json) and utf8::valid($json); # if it's valid utf8 mark it as such return $json; } +no Moose::Role; + 1; __END__