1JSON_PP(1) User Contributed Perl Documentation JSON_PP(1)
2
3
4
6 json_pp - JSON::PP command utility
7
9 json_pp [-v] [-f from_format] [-t to_format] [-json_opt options_to_json1[,options_to_json2[,...]]]
10
12 json_pp converts between some input and output formats (one of them is
13 JSON). This program was copied from json_xs and modified.
14
15 The default input format is json and the default output format is json
16 with pretty option.
17
19 -f
20 -f from_format
21
22 Reads a data in the given format from STDIN.
23
24 Format types:
25
26 json
27 as JSON
28
29 eval
30 as Perl code
31
32 -t
33 Writes a data in the given format to STDOUT.
34
35 null
36 no action.
37
38 json
39 as JSON
40
41 dumper
42 as Data::Dumper
43
44 -json_opt
45 options to JSON::PP
46
47 Acceptable options are:
48
49 ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref
50 allow_singlequote allow_barekey allow_bignum loose escape_slash indent_length
51
52 Multiple options must be separated by commas:
53
54 Right: -json_opt pretty,canonical
55
56 Wrong: -json_opt pretty -json_opt canonical
57
58 -v
59 Verbose option, but currently no action in fact.
60
61 -V
62 Prints version and exits.
63
65 $ perl -e'print q|{"foo":"あい","bar":1234567890000000000000000}|' |\
66 json_pp -f json -t dumper -json_opt pretty,utf8,allow_bignum
67
68 $VAR1 = {
69 'bar' => bless( {
70 'value' => [
71 '0000000',
72 '0000000',
73 '5678900',
74 '1234'
75 ],
76 'sign' => '+'
77 }, 'Math::BigInt' ),
78 'foo' => "\x{3042}\x{3044}"
79 };
80
81 $ perl -e'print q|{"foo":"あい","bar":1234567890000000000000000}|' |\
82 json_pp -f json -t dumper -json_opt pretty
83
84 $VAR1 = {
85 'bar' => '1234567890000000000000000',
86 'foo' => "\x{e3}\x{81}\x{82}\x{e3}\x{81}\x{84}"
87 };
88
90 JSON::PP, json_xs
91
93 Makamaka Hannyaharamitu, <makamaka[at]cpan.org>
94
96 Copyright 2010 by Makamaka Hannyaharamitu
97
98 This library is free software; you can redistribute it and/or modify it
99 under the same terms as Perl itself.
100
101
102
103perl v5.36.0 2022-07-31 JSON_PP(1)