> From: Reini Urban [email protected]
> First: Switch to ... Cpanel::JSON::XS
> The developer (me) is usually very responsive and it sounds 
> like a worthwhile feature. Reini,
I was looking into this and it seems like we could add another function search 
like TO_JSON. I’d like to recommend supporting TO_JSON_WITH_TYPE that would 
return a value like (HASH=>[a=>1, b=>2, c=>3]) or (BOOLEAN=>"Perl true") we 
might want to include the nominal ARRAY and SCALAR cases to round out the API.  
 Here's an example with Hash::Ordered that would give me what I need. 
perl -e '
use strict;
use warnings;
use Data::Dumper qw{Dumper};
use Hash::Ordered qw{};
*Hash::Ordered::TO_JSON_WITH_TYPE=sub {HASH=>shift->as_list};
use Cpanel::JSON::XS qw{};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 = Cpanel::JSON::XS->new->allow_blessed->convert_blessed;
print $coder->encode({hash=>$oh}), "\n";
'
 What do you think?
Mike mrdvt92
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to