I am trying to write a Python one-liner using xmltodict to convert an XML file to JSON. It seems like there's an issue reading from sys.stdin directly or as sys.stdin.buffer.read():
python -c 'import xmltodict, sys, json; json.dump(xmltodict.parse(sys.stdin, process_namespaces=True), sys.stdout, indent=4);' < foo.xml > bar.json