-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
102 lines (80 loc) · 2.55 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
NAME
Data::Printer::Filter::JSON - pretty-print your decoded JSON structures!
VERSION
Version 0.03
SYNOPSIS
# In your program:
use Data::Printer filters => {
-external => [ 'JSON' ],
};
# or, in your `.dataprinter' file:
{
filters => {
-external => [ 'JSON' ],
},
};
# You can also tweak the colors:
use Data::Printer {
filters => {
-external => [ 'JSON' ],
}, color => {
JSON => {
true => 'bright_blue on_black',
false => 'black on_bright_blue'
}
},
};
DESCRIPTION
Almost every JSON decoder on CPAN handles JavaScript's booleans with
objects, and some even reuse them in the resulting data structure. The
result? A tiny JSON like this:
{
"alpha": true,
"beta" : false,
"gamma": true,
"zeta" : false
}
Results in this Data::Printer output:
\ {
alpha JSON::XS::Boolean {
Parents JSON::Boolean
public methods (0)
private methods (1) : __ANON__
internals: 1
},
beta JSON::XS::Boolean {
Parents JSON::Boolean
public methods (0)
private methods (1) : __ANON__
internals: 0
},
gamma var{alpha},
zeta var{beta}
}
While all I wanted was this:
\ {
alpha true,
beta false,
gamma true,
zeta false
}
This module fixes that! :)
Handles
JSON::XS and JSON::PP (JSON 2.x), JSON::NotString (JSON 1.x),
JSON::DWIW, JSON::Parser, JSON::SL, Mojo::JSON, boolean (used by
Pegex::JSON) and JSON::JOM.
JSON::JOM Caveat
When working with JSON::JOM, make sure you load it after loading
Data::Printer. This is a known bug and garu's working on it!.
Can't Handle
The output of any JSON decoder that does NOT use a blessed reference for
its booleans, like JSON::Syck or JSON::Streaming::Reader.
AUTHOR
Nuba Princigalli <nuba@stastu.com>
CONTRIBUTORS
Tim Heaney <oylensheegul@gmail.com>
COPYRIGHT AND LICENSE
Copyright (c) 2012, Nuba Princigalli <nuba@stastu.com>. All rights
reserved.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.