ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.pm
(Generate patch)

Comparing JSON-XS/XS.pm (file contents):
Revision 1.170 by root, Thu Nov 15 22:35:35 2018 UTC vs.
Revision 1.176 by root, Tue Oct 27 18:05:58 2020 UTC

87 87
88package JSON::XS; 88package JSON::XS;
89 89
90use common::sense; 90use common::sense;
91 91
92our $VERSION = '4.0'; 92our $VERSION = '4.03';
93our @ISA = qw(Exporter); 93our @ISA = qw(Exporter);
94 94
95our @EXPORT = qw(encode_json decode_json); 95our @EXPORT = qw(encode_json decode_json);
96 96
97use Exporter; 97use Exporter;
521them via a call to the C<THAW> method. 521them via a call to the C<THAW> method.
522 522
523If C<$enable> is false (the default), then C<encode> will not consider 523If C<$enable> is false (the default), then C<encode> will not consider
524this type of conversion, and tagged JSON values will cause a parse error 524this type of conversion, and tagged JSON values will cause a parse error
525in C<decode>, as if tags were not part of the grammar. 525in C<decode>, as if tags were not part of the grammar.
526
527=item $json->boolean_values ([$false, $true])
528
529=item ($false, $true) = $json->get_boolean_values
530
531By default, JSON booleans will be decoded as overloaded
532C<$Types::Serialiser::false> and C<$Types::Serialiser::true> objects.
533
534With this method you can specify your own boolean values for decoding -
535on decode, JSON C<false> will be decoded as a copy of C<$false>, and JSON
536C<true> will be decoded as C<$true> ("copy" here is the same thing as
537assigning a value to another variable, i.e. C<$copy = $false>).
538
539Calling this method without any arguments will reset the booleans
540to their default values.
541
542C<get_boolean_values> will return both C<$false> and C<$true> values, or
543the empty list when they are set to the default.
526 544
527=item $json = $json->filter_json_object ([$coderef->($hashref)]) 545=item $json = $json->filter_json_object ([$coderef->($hashref)])
528 546
529When C<$coderef> is specified, it will be called from C<decode> each 547When C<$coderef> is specified, it will be called from C<decode> each
530time it decodes a JSON object. The only argument is a reference to 548time it decodes a JSON object. The only argument is a reference to

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines