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: http://jsonprettyprint.com/
Print article | This entry was posted by elvis on 12/06/13 at 09:11:00 pm . Follow any responses to this post through RSS 2.0. |