… | |
… | |
1608 | |
1608 | |
1609 | =head1 INTEROPERABILITY WITH OTHER MODULES |
1609 | =head1 INTEROPERABILITY WITH OTHER MODULES |
1610 | |
1610 | |
1611 | C<JSON::XS> uses the L<Types::Serialiser> module to provide boolean |
1611 | C<JSON::XS> uses the L<Types::Serialiser> module to provide boolean |
1612 | constants. That means that the JSON true and false values will be |
1612 | constants. That means that the JSON true and false values will be |
1613 | comaptible to true and false values of iother modules that do the same, |
1613 | comaptible to true and false values of other modules that do the same, |
1614 | such as L<JSON::PP> and L<CBOR::XS>. |
1614 | such as L<JSON::PP> and L<CBOR::XS>. |
1615 | |
1615 | |
1616 | |
1616 | |
1617 | =head1 INTEROPERABILITY WITH OTHER JSON DECODERS |
1617 | =head1 INTEROPERABILITY WITH OTHER JSON DECODERS |
1618 | |
1618 | |
… | |
… | |
1635 | |
1635 | |
1636 | When you use C<allow_tags> to use the extended (and also nonstandard and |
1636 | When you use C<allow_tags> to use the extended (and also nonstandard and |
1637 | invalid) JSON syntax for serialised objects, and you still want to decode |
1637 | invalid) JSON syntax for serialised objects, and you still want to decode |
1638 | the generated When you want to serialise objects, you can run a regex |
1638 | the generated When you want to serialise objects, you can run a regex |
1639 | to replace the tagged syntax by standard JSON arrays (it only works for |
1639 | to replace the tagged syntax by standard JSON arrays (it only works for |
1640 | "normal" packagesnames without comma, newlines or single colons). First, |
1640 | "normal" package names without comma, newlines or single colons). First, |
1641 | the readable Perl version: |
1641 | the readable Perl version: |
1642 | |
1642 | |
1643 | # if your FREEZE methods return no values, you need this replace first: |
1643 | # if your FREEZE methods return no values, you need this replace first: |
1644 | $json =~ s/\( \s* (" (?: [^\\":,]+|\\.|::)* ") \s* \) \s* \[\s*\]/[$1]/gx; |
1644 | $json =~ s/\( \s* (" (?: [^\\":,]+|\\.|::)* ") \s* \) \s* \[\s*\]/[$1]/gx; |
1645 | |
1645 | |
… | |
… | |
1681 | Since this module was written, Google has written a new JSON RFC, RFC 7159 |
1681 | Since this module was written, Google has written a new JSON RFC, RFC 7159 |
1682 | (and RFC7158). Unfortunately, this RFC breaks compatibility with both the |
1682 | (and RFC7158). Unfortunately, this RFC breaks compatibility with both the |
1683 | original JSON specification on www.json.org and RFC4627. |
1683 | original JSON specification on www.json.org and RFC4627. |
1684 | |
1684 | |
1685 | As far as I can see, you can get partial compatibility when parsing by |
1685 | As far as I can see, you can get partial compatibility when parsing by |
1686 | using C<< ->allow_nonref >>. However, consider thew security implications |
1686 | using C<< ->allow_nonref >>. However, consider the security implications |
1687 | of doing so. |
1687 | of doing so. |
1688 | |
1688 | |
1689 | I haven't decided yet when to break compatibility with RFC4627 by default |
1689 | I haven't decided yet when to break compatibility with RFC4627 by default |
1690 | (and potentially leave applications insecure) and change the default to |
1690 | (and potentially leave applications insecure) and change the default to |
1691 | follow RFC7159, but application authors are well advised to call C<< |
1691 | follow RFC7159, but application authors are well advised to call C<< |
1692 | ->allow_nonref(0) >> even if this is the current default, if they cannot |
1692 | ->allow_nonref(0) >> even if this is the current default, if they cannot |
1693 | handle non-reference values, in preparation for the day when the4 default |
1693 | handle non-reference values, in preparation for the day when the default |
1694 | will change. |
1694 | will change. |
1695 | |
1695 | |
1696 | |
1696 | |
1697 | =head1 THREADS |
1697 | =head1 THREADS |
1698 | |
1698 | |