Batch Convert XML Files to JSON with xml-json for Node and Terminal Magic

To batch convert XML files to JSON a nodejs package can be used that does the job pretty well.

Install the package globally:

npm install xml-json -g

the format of the command is

xml-json input.xml root_node_to_start_from_in_xml

And so we use our friend inline loop with the basic command to batch process all the *.xml files in the current folder

for f in *.xml; do xml-json $f root_node_name_here > $f.json; done