- use Data::Dumper;
use Data::Printer;
use JSON::Any;
my $foo = JSON::Any->new->jsonToObj(
print Dumper ($foo), "\n";
print np ($foo), "\n";
That prints this unreadable garbage:
- $VAR1 = {
'b' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
'a' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
'c' => $VAR1->{'a'}
};
\ {
a JSON::PP::Boolean {
public methods (0)
private methods (1) : __ANON__
internals: 1
},
b JSON::PP::Boolean {
public methods (0)
private methods (1) : __ANON__
internals: 0
},
c var{a}
}
When I just want to see:
- {
'a' => 1,
'b' => 0,
'c' => 1
};
None of this works:
- $JSON::PP::true = 1;
$JSON::PP::false = 0;
sub JSON::PP::true { return 1 };
sub JSON::PP::false { return 0 };
$JSON::Any::true = 1;
$JSON::Any::false = 0;
sub JSON::Any::true { return 1 };
sub JSON::Any::false { return 0 };
This almost works:
- sub JSON::PP::Boolean::_data_printer {
return ($_[0] eq JSON::PP::true ? "1" : "0") }
But this is still stupid:
- \ {
a 0,
b 1,
c var{a}
}