… | |
… | |
309 | ] |
309 | ] |
310 | { |
310 | { |
311 | "k1": "v1", |
311 | "k1": "v1", |
312 | "k2": "v2", <- this comma not normally allowed |
312 | "k2": "v2", <- this comma not normally allowed |
313 | } |
313 | } |
|
|
314 | |
|
|
315 | =item * shell-style '#'-comments |
|
|
316 | |
|
|
317 | Whenever JSON allows whitespace, shell-style comments are additionally |
|
|
318 | allowed. They are terminated by the first carriage-return or line-feed |
|
|
319 | character, after which more white-space and comments are allowed. |
|
|
320 | |
|
|
321 | [ |
|
|
322 | 1, # this comment not allowed in JSON |
|
|
323 | # neither this one... |
|
|
324 | ] |
314 | |
325 | |
315 | =back |
326 | =back |
316 | |
327 | |
317 | =item $json = $json->canonical ([$enable]) |
328 | =item $json = $json->canonical ([$enable]) |
318 | |
329 | |
… | |
… | |
655 | to_json [\0,JSON::XS::true] # yields [false,true] |
666 | to_json [\0,JSON::XS::true] # yields [false,true] |
656 | |
667 | |
657 | =item JSON::XS::true, JSON::XS::false |
668 | =item JSON::XS::true, JSON::XS::false |
658 | |
669 | |
659 | These special values become JSON true and JSON false values, |
670 | These special values become JSON true and JSON false values, |
660 | respectively. You cna alos use C<\1> and C<\0> directly if you want. |
671 | respectively. You can also use C<\1> and C<\0> directly if you want. |
661 | |
672 | |
662 | =item blessed objects |
673 | =item blessed objects |
663 | |
674 | |
664 | Blessed objects are not allowed. JSON::XS currently tries to encode their |
675 | Blessed objects are not allowed. JSON::XS currently tries to encode their |
665 | underlying representation (hash- or arrayref), but this behaviour might |
676 | underlying representation (hash- or arrayref), but this behaviour might |