Linux Command Line - Convert XML to JSON

This was the answer to a question that came in an email - "Do you know of a good XML to JSON converter?"

Obviously you need php-cli, JSON, and SimpleXML. :)

The "xml" is the name of the file that contains the XML, the output can be piped to a different file.

php -r 'echo json_encode(simplexml_load_file("xml"));'

If you would like it pretty printed, this page is really nice: