fix hash order randomization issue: use canonical mode with JSON (RT#84287)
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Format / JSON.pm
index bc8316c..1afda1b 100644 (file)
@@ -21,7 +21,7 @@ sub thaw {
 
 sub freeze {
     my ( $self, @args ) = @_;
-    my $json = JSON::Any->new->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;
 }