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'} :
deprecated and you will receive warnings in your log.
You can also add a hash in your controller config to pass options to the json object.
+There are two options. C<json_options> are used when decoding incoming JSON, and C<json_options_encode>
+is used when encoding JSON for output.
+
For instance, to relax permissions when deserializing input, add:
+
__PACKAGE__->config(
json_options => { relaxed => 1 }
)
+To indent the JSON output so it becomes more human readable, add:
+
+ __PACKAGE__->config(
+ json_options_encode => { indent => 1 }
+ )
+
+
=item * C<text/javascript> => C<JSONP>
If a callback=? parameter is passed, this returns javascript in the form of: $callback($serializedJSON);