<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:16px"><div id="yui_3_16_0_1_1428981335866_6310">> From: Reini Urban <a href="mailto:rurban@x-ray.at">rurban@x-ray.at</a><br>> First: Switch to ... Cpanel::JSON::XS<br>> The developer (me) is usually very responsive and it sounds <br>> like a worthwhile feature.</div><div id="yui_3_16_0_1_1428981335866_6311"> </div><div id="yui_3_16_0_1_1428981335866_6309">Reini,<br>I was looking into this and it seems like we could add another function search like TO_JSON.</div><div id="yui_3_16_0_1_1428981335866_6312"> </div><div id="yui_3_16_0_1_1428981335866_6308">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.  </div><div id="yui_3_16_0_1_1428981335866_6313"> </div><div id="yui_3_16_0_1_1428981335866_6299">Here's an example with Hash::Ordered that would give me what I need.</div><div id="yui_3_16_0_1_1428981335866_6314"> </div><blockquote id="yui_3_16_0_1_1428981335866_6378" style="margin-right: 0px;" dir="ltr"><div id="yui_3_16_0_1_1428981335866_6303">perl -e '<br>use strict;<br>use warnings;<br>use Data::Dumper qw{Dumper};<br>use Hash::Ordered qw{};<br>*Hash::Ordered::TO_JSON_WITH_TYPE=sub {HASH=>shift->as_list};<br>use Cpanel::JSON::XS qw{};</div><div id="yui_3_16_0_1_1428981335866_6315">my $oh=Hash::Ordered->new(a => 1, b=>2, c=>3, d=>4, e=>5);<br>print Dumper($oh);<br>print join(",", $oh->TO_JSON_WITH_TYPE), "\n";<br>my $coder = Cpanel::JSON::XS->new->allow_blessed->convert_blessed;<br>print $coder->encode({hash=>$oh}), "\n";<br>'</div></blockquote><div id="yui_3_16_0_1_1428981335866_6316"> </div><div id="yui_3_16_0_1_1428981335866_6325">What do you think?<br>Mike</div><div id="yui_3_16_0_1_1428981335866_6326"> </div><div id="yui_3_16_0_1_1428981335866_6324">mrdvt92</div></div></body></html>