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.73 by root, Sun Nov 25 19:36:54 2007 UTC vs.
Revision 1.76 by root, Sun Dec 2 15:34:13 2007 UTC

84 84
85package JSON::XS; 85package JSON::XS;
86 86
87use strict; 87use strict;
88 88
89our $VERSION = '1.6'; 89our $VERSION = '2.0';
90our @ISA = qw(Exporter); 90our @ISA = qw(Exporter);
91 91
92our @EXPORT = qw(to_json from_json); 92our @EXPORT = qw(to_json from_json);
93 93
94use Exporter; 94use Exporter;
276 276
277 use Encode; 277 use Encode;
278 $object = JSON::XS->new->decode (decode "UTF-32LE", $jsontext); 278 $object = JSON::XS->new->decode (decode "UTF-32LE", $jsontext);
279 279
280=item $json = $json->pretty ([$enable]) 280=item $json = $json->pretty ([$enable])
281
282=item $enabled = $json->get_pretty
283 281
284This enables (or disables) all of the C<indent>, C<space_before> and 282This enables (or disables) all of the C<indent>, C<space_before> and
285C<space_after> (and in the future possibly more) flags in one call to 283C<space_after> (and in the future possibly more) flags in one call to
286generate the most readable (or most compact) form possible. 284generate the most readable (or most compact) form possible.
287 285
429 JSON::XS->new->allow_nonref->encode ("Hello, World!") 427 JSON::XS->new->allow_nonref->encode ("Hello, World!")
430 => "Hello, World!" 428 => "Hello, World!"
431 429
432=item $json = $json->allow_blessed ([$enable]) 430=item $json = $json->allow_blessed ([$enable])
433 431
434=item $enabled = $json->get_allow_bless 432=item $enabled = $json->get_allow_blessed
435 433
436If C<$enable> is true (or missing), then the C<encode> method will not 434If C<$enable> is true (or missing), then the C<encode> method will not
437barf when it encounters a blessed reference. Instead, the value of the 435barf when it encounters a blessed reference. Instead, the value of the
438B<convert_blessed> option will decide whether C<null> (C<convert_blessed> 436B<convert_blessed> option will decide whether C<null> (C<convert_blessed>
439disabled or no C<to_json> method found) or a representation of the 437disabled or no C<TO_JSON> method found) or a representation of the
440object (C<convert_blessed> enabled and C<to_json> method found) is being 438object (C<convert_blessed> enabled and C<TO_JSON> method found) is being
441encoded. Has no effect on C<decode>. 439encoded. Has no effect on C<decode>.
442 440
443If C<$enable> is false (the default), then C<encode> will throw an 441If C<$enable> is false (the default), then C<encode> will throw an
444exception when it encounters a blessed object. 442exception when it encounters a blessed object.
445 443

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines