… | |
… | |
521 | them via a call to the C<THAW> method. |
521 | them via a call to the C<THAW> method. |
522 | |
522 | |
523 | If C<$enable> is false (the default), then C<encode> will not consider |
523 | If C<$enable> is false (the default), then C<encode> will not consider |
524 | this type of conversion, and tagged JSON values will cause a parse error |
524 | this type of conversion, and tagged JSON values will cause a parse error |
525 | in C<decode>, as if tags were not part of the grammar. |
525 | in 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 | |
|
|
531 | By default, JSON booleans will be decoded as overloaded |
|
|
532 | C<$Types::Serialiser::false> and C<$Types::Serialiser::true> objects. |
|
|
533 | |
|
|
534 | With this method you can specify your own boolean values for decoding - |
|
|
535 | on decode, JSON C<false> will be decoded as a copy of C<$false>, and JSON |
|
|
536 | C<true> will be decoded as C<$true> ("copy" here is the same thing as |
|
|
537 | assigning a value to another variable, i.e. C<$copy = $false>). |
|
|
538 | |
|
|
539 | Calling this method without any arguments will reset the booleans |
|
|
540 | to their default values. |
|
|
541 | |
|
|
542 | C<get_boolean_values> will return both C<$false> and C<$true> values, or |
|
|
543 | the 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 | |
529 | When C<$coderef> is specified, it will be called from C<decode> each |
547 | When C<$coderef> is specified, it will be called from C<decode> each |
530 | time it decodes a JSON object. The only argument is a reference to |
548 | time it decodes a JSON object. The only argument is a reference to |