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.176 by root, Tue Oct 27 18:05:58 2020 UTC vs.
Revision 1.177 by root, Sun Jan 9 21:26:24 2022 UTC

429 429
430=item $json = $json->allow_nonref ([$enable]) 430=item $json = $json->allow_nonref ([$enable])
431 431
432=item $enabled = $json->get_allow_nonref 432=item $enabled = $json->get_allow_nonref
433 433
434Unlike other boolean options, this opotion is enabled by default beginning 434Unlike other boolean options, this option is enabled by default beginning
435with version C<4.0>. See L<SECURITY CONSIDERATIONS> for the gory details. 435with version C<4.0>. See L<SECURITY CONSIDERATIONS> for the gory details.
436 436
437If C<$enable> is true (or missing), then the C<encode> method can convert a 437If C<$enable> is true (or missing), then the C<encode> method can convert a
438non-reference into its corresponding string, number or null JSON value, 438non-reference into its corresponding string, number or null JSON value,
439which is an extension to RFC4627. Likewise, C<decode> will accept those JSON 439which is an extension to RFC4627. Likewise, C<decode> will accept those JSON
1193In this case, the C<TO_JSON> method of the object is invoked in scalar 1193In this case, the C<TO_JSON> method of the object is invoked in scalar
1194context. It must return a single scalar that can be directly encoded into 1194context. It must return a single scalar that can be directly encoded into
1195JSON. This scalar replaces the object in the JSON text. 1195JSON. This scalar replaces the object in the JSON text.
1196 1196
1197For example, the following C<TO_JSON> method will convert all L<URI> 1197For example, the following C<TO_JSON> method will convert all L<URI>
1198objects to JSON strings when serialised. The fatc that these values 1198objects to JSON strings when serialised. The fact that these values
1199originally were L<URI> objects is lost. 1199originally were L<URI> objects is lost.
1200 1200
1201 sub URI::TO_JSON { 1201 sub URI::TO_JSON {
1202 my ($uri) = @_; 1202 my ($uri) = @_;
1203 $uri->as_string 1203 $uri->as_string

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines