A quick patch that works for me, please see if it is compatible with the way you want the code to work. (Apologies if the patch is not correct, I am not too familiar with creating patch files).

Tatsuhiko Miyagawa wrote:
On 12/3/07, Ian Docherty <[EMAIL PROTECTED]> wrote:

On looking at the code for C::V::JSON it creates a new JSON::Any object
but does not pass on any parameters (probably because there is no
standard parameter mappings for the different JSON modules).

I am at a loss as to how to do this without writing my own C::V::JSON

Can you s/writing my own/submtiting a patch for/?


@@ -9,7 +9,7 @@
use Catalyst::Exception;
require JSON::Any;

-__PACKAGE__->mk_accessors(qw( allow_callback callback_param expose_stash encoding json_dumper no_x_json_header )); +__PACKAGE__->mk_accessors(qw( params allow_callback callback_param expose_stash encoding json_dumper no_x_json_header ));

sub new {
    my($class, $c, $arguments) = @_;
@@ -29,7 +29,7 @@

    eval {
        JSON::Any->import($driver);
-        my $json = JSON::Any->new; # create the copy of JSON handler
+ my $json = JSON::Any->new(%{$self->params}); # create the copy of JSON handler
        $self->json_dumper(sub { $json->objToJson($_[0]) });
    };

@@ -134,6 +134,7 @@
  MyApp->config({
      ...
      'View::JSON' => {
+ params => {pretty => 1, indent => 2}, # pass params to the JSON module
          allow_callback  => 1,    # defaults to 0
          callback_param  => 'cb', # defaults to 'callback'
          expose_stash    => [ qw(foo bar) ], # defaults to everything

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to