4 BEGIN { plan tests => 3 };
6 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
8 use JSON -convert_blessed_universally;
11 my $obj = Test->new( [ 1, 2, {foo => 'bar'} ] );
13 $obj->[3] = Test2->new( { a => 'b' } );
15 my $json = JSON->new->allow_blessed->convert_blessed;
17 is( $json->encode( $obj ), '[1,2,{"foo":"bar"},"hoge"]' );
19 $json->convert_blessed(0);
21 is( $json->encode( $obj ), 'null' );
23 $json->allow_blessed(0)->convert_blessed(1);
25 is( $json->encode( $obj ), '[1,2,{"foo":"bar"},"hoge"]' );