Reini,I added the TO_JSON_WITH_TYPE API to my JSON fork on Github.  Let me know 
what you think.  I like this API much better than the TO_JSON API.  It supports 
BOOLEAN out of the box as well. It's just a better all around API.  I coded it 
so if the object has both TO_JSON and TO_JSON_WITH_TYPE the "with type" method 
will be selected first so we can have backwards compatibility too.Thanks,Mike 
https://github.com/makamaka/JSON/compare/master...mrdvt92:master perl -e '
use strict;
use warnings;
use blib;
BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
use JSON;
use Data::Dumper qw{Dumper};use Hash::Ordered qw{};
sub Hash::Ordered::TO_JSON_WITH_TYPE {HASH=>[shift->as_list]};
my $oh=Hash::Ordered->new(a => 1, b=>2, c=>3, d=>4, e=>5);
#print Dumper($oh);
#print join(",", @{$oh->TO_JSON_WITH_TYPE()}), "\n";my $coder = 
JSON->new->allow_blessed->convert_blessed;
print $coder->encode({myhash=>$oh}), "\n";
' {"myhash":{"a":1,"b":2,"c":3,"d":4,"e":5}}


_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to