1JSON::Whitespace(3) User Contributed Perl Documentation JSON::Whitespace(3)
2
3
4
6 JSON::Whitespace - Alter the insignificant whitespace of JSON
7
9 use JSON::Whitespace ':all';
10
11 my $in = <<EOF;
12 {
13 "animals":{
14 "kingkong":"🦍"
15 },
16 "baka":[
17 "ドジ"
18 ],
19 "fruit":{
20 "grape":"🍇"
21 },
22 "moons":{
23 "🌑":0
24 }
25 }
26 EOF
27 my $minify = json_minify ($in);
28 print $minify;
29
30 This outputs
31
32 {"animals":{"kingkong":"🦍"},"baka":["ドジ"],"fruit":{"grape":"🍇"},"moons":{"🌑":0}}
33
35 This documents version 0.60 of JSON::Whitespace corresponding to git
36 commit 27b70e98176290ddd145cadfe8aa6ff43bb71703
37 <https://github.com/benkasminbullock/JSON-
38 Parse/commit/27b70e98176290ddd145cadfe8aa6ff43bb71703> released on Tue
39 Jan 26 08:51:47 2021 +0900.
40
42 This module offers functions to manipulate the "insignificant
43 whitespace" part of a JSON string (the whitespace which is not inside
44 strings). According to the JSON specification "insignificant
45 whitespace" consists of space (%x20), horizontal tab (%x09), line feed
46 or new line (%x0A) and carriage return ("%x0D)."
47
49 json_minify
50 my $minified = json_minify ($json);
51
52 Remove all whitespace, including trailing newlines, from $json.
53
55 Documentation about JSON is in JSON::Parse. JSON::Whitespace is based
56 on JSON::Tokenize, which breaks JSON into tokens without putting it
57 into Perl structures.
58
60 Ben Bullock, <bkb@cpan.org>
61
63 This package and associated files are copyright (C) 2016-2021 Ben
64 Bullock.
65
66 You can use, copy, modify and redistribute this package and associated
67 files under the Perl Artistic Licence or the GNU General Public
68 Licence.
69
71 Hey! The above document had some coding errors, which are explained
72 below:
73
74 Around line 45:
75 Unterminated C<...> sequence
76
77
78
79perl v5.32.1 2021-01-31 JSON::Whitespace(3)