LinuxCommandLibrary

json_pp

TLDR

Pretty print JSON

$ cat [data.json] | json_pp
copy
Format JSON file
$ json_pp < [input.json] > [output.json]
copy
Specify indentation
$ json_pp -json_opt indent [4] < [data.json]
copy
Sort keys
$ json_pp -json_opt canonical < [data.json]
copy
Compact output
$ json_pp -json_opt indent [0] < [data.json]
copy

SYNOPSIS

json_pp [options]

DESCRIPTION

json_pp is a JSON pretty printer from Perl. It reads JSON from stdin and outputs formatted JSON.
The tool provides basic formatting and validation. It's often pre-installed on systems with Perl.
json_pp formats JSON output.

PARAMETERS

-json_opt OPTIONS

JSON formatting options.
indent N
Indentation level.
canonical
Sort keys alphabetically.
pretty
Pretty print (default).
-f FORMAT
Input format.
-t FORMAT
Output format.

CAVEATS

Perl-based. Basic functionality. Consider jq for complex operations.

HISTORY

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

SEE ALSO

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

Copied to clipboard