JSON_PP(1)
๐ธ NAME ๐ธ
okay so bestie, welcome to json_pp โ the JSON::PP command utility, living its best life in section 1 of the Perl Programmers Reference Guide. She converts stuff between formats and she ate, no cap ๐
โจ SYNOPSIS โจ
json_pp [-v] [-f from_format] [-t to_format] [-json_opt options_to_json1[,options_to_json2[,...]]]
๐ฆ DESCRIPTION ๐ฆ
So json_pp converts between some input and output formats โ and yes, one of them is JSON (the main character, obvi) ๐ This program was copied from json_xs and then modified, so she's got lore. Ngl, she's basically json_xs's little sister and she's thriving.
The default input format is json and the default output format is json with the pretty option. So if you just pipe something in with zero flags, she'll hand you back gorgeous pretty-printed JSON like it's nothing ๐
๐ OPTIONS ๐
-f
-ffrom_format โ reads your data in the given format from STDIN. That's the input side of the story, bestie.
Format types you can pick from:
jsonโ as JSON ๐งevalโ as Perl code
-t
-tโ writes your data in the given format to STDOUT. Output side, let's go.
Format types:
nullโ no action. Like, literally nothing happens. She's on break ๐jsonโ as JSON โญdumperโ asData::Dumper
-json_opt
-json_optโ options toJSON::PP. This is where you customise the vibe โจ
Acceptable options are:
ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref
allow_singlequote allow_barekey allow_bignum loose escape_slash indent_length
Multiple options must be separated by commas. This is so important:
Right: -json_opt pretty,canonical
Wrong: -json_opt pretty -json_opt canonical
fr fr, do not repeat the flag. Comma-separate them or she will not be happy with you ๐ญ
-v
-vโ the verbose option, but currently no action in fact. She's giving "I'm here for moral support" energy. Iconic of her honestly ๐
-V
-Vโ prints the version and exits. Short and sweet, a true queen ๐
๐ฅ EXAMPLES ๐ฅ
Here's our first slay โ note the allow_bignum doing its absolute thing:
$ perl -e'print q|{"foo":"ใใ","bar":1234567890000000000000000}|' |\
json_pp -f json -t dumper -json_opt pretty,utf8,allow_bignum
$VAR1 = {
'bar' => bless( {
'value' => [
'0000000',
'0000000',
'5678900',
'1234'
],
'sign' => '+'
}, 'Math::BigInt' ),
'foo' => "\x{3042}\x{3044}"
};
See how the big number got blessed into a Math::BigInt? That's the allow_bignum option carrying the whole team ๐ซถ
Now the same input, but without allow_bignum โ watch what happens to our giant number:
$ perl -e'print q|{"foo":"ใใ","bar":1234567890000000000000000}|' |\
json_pp -f json -t dumper -json_opt pretty
$VAR1 = {
'bar' => '1234567890000000000000000',
'foo' => "\x{e3}\x{81}\x{82}\x{e3}\x{81}\x{84}"
};
Yeah โ the number stays a plain string and the string gets escaped. Different vibe entirely, lowkey fascinating ๐
๐ SEE ALSO ๐
JSON::PPjson_xs
Go read those next, bestie, they're the extended universe ๐
๐ AUTHOR ๐
Makamaka Hannyaharamitu, <makamaka[at]cpan.org>
๐ COPYRIGHT AND LICENSE ๐
Copyright 2010 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, you're officially caught up ๐ this was json_pp(1) from the Perl Programmers Reference Guide, brought to you by perl v5.42.3 and dated 2026-11-03 โ go forth and pretty-print, bestie, mwah ๐โจ๐
๐ฆ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms