logo

XML Cheatsheet

Python

Convert XML to JSON

Install xmltodict

$ sudo pip install xmltodict

Python Code:

import json
import xmltodict

s = open("foo.xml").read()
d = xmltodict.parse(s)
json.dump(d, open("bar.json",'w'))