1 |
=head1 NAME |
2 |
|
3 |
JSON::XS - JSON serialising/deserialising, done correctly and fast |
4 |
|
5 |
=head1 SYNOPSIS |
6 |
|
7 |
use JSON::XS; |
8 |
|
9 |
=head1 DESCRIPTION |
10 |
|
11 |
=over 4 |
12 |
|
13 |
=cut |
14 |
|
15 |
package JSON::XS; |
16 |
|
17 |
BEGIN { |
18 |
$VERSION = '0.1'; |
19 |
@ISA = qw(Exporter); |
20 |
|
21 |
require Exporter; |
22 |
|
23 |
require XSLoader; |
24 |
XSLoader::load JSON::XS::, $VERSION; |
25 |
} |
26 |
|
27 |
=item |
28 |
|
29 |
=cut |
30 |
|
31 |
use JSON::DWIW; |
32 |
use Benchmark; |
33 |
|
34 |
use utf8; |
35 |
#my $json = '{"ü":1,"a":[1,{"3":4},2],"b":5,"üü":2}'; |
36 |
my $json = '{"test":9555555555555555555,"hu" : -1e+5, "arr" : [ 1,2,3,4,5]}'; |
37 |
|
38 |
my $js = JSON::XS->new; |
39 |
warn $js->indent (0); |
40 |
warn $js->canonical (0); |
41 |
warn $js->ascii (0); |
42 |
warn $js->space_after (0); |
43 |
use Data::Dumper; |
44 |
warn Dumper $js->decode ($json); |
45 |
warn Dumper $js->encode ($js->decode ($json)); |
46 |
#my $x = {"üü" => 2, "ü" => 1, "a" => [1,{3,4},2], b => 5}; |
47 |
|
48 |
#my $js2 = JSON::DWIW->new; |
49 |
# |
50 |
#timethese 200000, { |
51 |
# a => sub { $js->encode ($x) }, |
52 |
# b => sub { $js2->to_json ($x) }, |
53 |
#}; |
54 |
|
55 |
1; |
56 |
|
57 |
=back |
58 |
|
59 |
=head1 AUTHOR |
60 |
|
61 |
Marc Lehmann <schmorp@schmorp.de> |
62 |
http://home.schmorp.de/ |
63 |
|
64 |
=cut |
65 |
|