I think Mojo::JSON handled the booleans about as well as can be expected
with Perl.

examples:

perl -Mojo -E 'my $true_scalar = "1"; my $false_scalar = "0"; say j([1,
"1", \1, Mojo::JSON->true, \$true_scalar, 0, "0", \0, Mojo::JSON->false,
\$false_scalar])'

perl -Mojo -E 'say j([1, \1, Mojo::JSON->true])'

IRC conversation about it:
http://irclog.perlgeek.de/mojo/2014-11-27



On Tue, Dec 16, 2014 at 10:58 AM, Mark Overmeer <[email protected]> wrote:
>
> * Patrick Powell ([email protected]) [141216 15:34]:
> > Ummm... and look at JSON and 'true' and 'false'.
>
> Correct.  In Apache::Solr, I ended up building tables of fields and which
> are boolean, to automatically translate Perl's concept of booleans into
> Solr's URI parameters.
>
> IMO Perl libraries should attempt to hide the typedness of interfaces...
> JSON itself is on a too basic level to do it itself.  But interfaces
> which transport their data via JSON could (should?) try to automate the
> required conversions... often quite some work.
> --
> Regards,
>
>                MarkOv
>
> ------------------------------------------------------------------------
>        Mark Overmeer MSc                                MARKOV Solutions
>        [email protected]                          [email protected]
> http://Mark.Overmeer.net                   http://solutions.overmeer.net
>
>
> _______________________________________________
> Xml-compile mailing list
> [email protected]
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile
>
_______________________________________________
Xml-compile mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile

Reply via email to