Pretty Printing from the Commmand Line

DateTags

JSON

The python standard library provides a json library that can be used to pretty print json.

$  echo '{"this": ["that"]}' | python -m json.tool
{
  "this": [
      "that"
  ]
}

XML

$  echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' | xmllint --format -
<?xml version="1.0"?>
<root>
  <foo a="b">lorem</foo …
more ...