1inc::JSON(3) User Contributed Perl Documentation inc::JSON(3)
2
3
4
6 JSON - A JSON:PP/JSON::XS Factory Class
7
9 use JSON;
10 my $json = JSON->new->utf8->pretty->encode(\%data);
11
13 This is purely a fallback factory class that helps keep our code clean.
14
15 This is for people with a clean perl 5.14+ install that have JSON::PP
16 but not JSON. Also people that installed JSON::XS on a pre-5.14 system.
17
18 my $class = JSON->find_base_class()
19 On success returns one of: JSON::XS, JSON::PP
20
21 Returns undef on failure.
22
23 my $obj = JSON->new(<arguments>)
24 If a base class is found, will return an instantiated object.
25
26 This will die() if no base class could be found.
27
29 (c) 2014, All rights reserved.
30
31 * Abe Timmerman <abeltje@cpan.org>
32
33 This library is free software; you can redistribute it and/or modify it
34 under the same terms as Perl itself.
35
36 See:
37
38 · <http://www.perl.com/perl/misc/Artistic.html>
39
40 · <http://www.gnu.org/copyleft/gpl.html>
41
42 This program is distributed in the hope that it will be useful, but
43 WITHOUT ANY WARRANTY; without even the implied warranty of
44 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
45
46
47
48perl v5.28.1 2017-05-22 inc::JSON(3)