Using Python JSON tool

$ python -m json.tool [inline] [outfile]
$ python -m json.tool file.json

Useful if posting from clipboard.

$ echo '{"foo":1}' | python -m json.tool
{
    "foo": 1
}

Using JavaScript JQ tool

Homepage: stedolan.github.io/jq/

Example:

URL='https://api.github.com/repos/stedolan/jq/commits?per_page=5'
curl "$URL" | jq '.'
curl "$URL" | jq '.[0] | {message: .commit.message, name: .commit.committer.name}'

Using JSON CLI

Homepage: trentm.com/json/

Repo: trentm/json

This tool is a Node.js tool with no external dependencies.

$ npm install -g json
$ json --version
json 9.0.0
NAME

json - JSON love for your command line
SYNOPSIS

something-generating-JSON-on-stdout | json [OPTIONS] [LOOKUPS]

json -f FILE [OPTIONS] [LOOKUPS...]

Sample usage:

$ echo '{"foo":"bar"}' | json
{
  "foo": "bar"
}
$ echo '{"foo":"bar"}' | json foo
bar