LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

json_pp

JSON pretty printer from Perl

TLDR

Pretty print JSON
$ json_pp < [data.json]
copy
Format JSON file to output file
$ json_pp < [input.json] > [output.json]
copy
Sort keys alphabetically
$ json_pp -json_opt canonical < [data.json]
copy
Output as Perl Data::Dumper format
$ json_pp -t dumper < [data.json]
copy
Use multiple formatting options
$ json_pp -json_opt pretty,canonical,utf8 < [data.json]
copy
Print version
$ json_pp -V
copy

SYNOPSIS

json_pp [-v] [-f fromformat] [**-t** toformat] [-json_opt options]

DESCRIPTION

json_pp is a JSON::PP command utility that converts between input and output formats (one of which is JSON). It reads from stdin and outputs to stdout. Default behavior is pretty-printed JSON output.The tool provides basic formatting and validation. It's often pre-installed on systems with Perl.

PARAMETERS

-f FORMAT

Input format: json (default) or eval (Perl code).
-t FORMAT
Output format: json (default), dumper (Data::Dumper), or null.
-json_opt OPTIONS
Comma-separated JSON formatting options: ascii, latin1, utf8, pretty, indent, spacebefore, spaceafter, relaxed, canonical, allownonref, allowsinglequote, allowbarekey, allowbignum, loose, escapeslash, indentlength.
-v
Verbose mode (currently no action).
-V
Print version and exit.

CAVEATS

Multiple -json_opt values must be comma-separated in a single option, not as separate flags. Consider jq for complex JSON operations.

HISTORY

json_pp is part of Perl's JSON::PP module, providing a simple command-line JSON formatter.

SEE ALSO

jq(1), python(1), jsonlint(1)

Copied to clipboard
Kai