v1.21
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Serialize / JSON.pm
index 127014e..e618248 100644 (file)
@@ -6,8 +6,6 @@ use namespace::autoclean;
 extends 'Catalyst::Action';
 use JSON::MaybeXS qw(JSON);
 
-# VERSION
-
 has encoder => (
    is => 'ro',
    lazy_build => 1,
@@ -22,6 +20,12 @@ sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
 
+    if (my $options = $controller->{json_options_encode}) {
+        foreach my $opt (keys %$options) {
+            $self->encoder->$opt( $options->{$opt} );
+        }
+    }
+
     my $stash_key = (
             $controller->{'serialize'} ?
                 $controller->{'serialize'}->{'stash_key'} :