Howto beautify xml and json from a bash script

Sometime may happens you need to beautify xml or json from a bash script. So here there are two methods to easily obtaing a pretty print of your data:

Command to beautify XML

cat filename.xml | xmllint --format -

Command to beautify JSON

cat filename.json | python -m json.tool

In case you miss above tools on your system, they can be installed with

sudo apt-get install libxml2-utils
sudo apt-get install python
sudo pip install simplejson

Good luck!