from lxml.etree import fromstring, tostring
xml = fromstring('<p id="1">text</p>')
json.dumps(xmljson.badgerfish.data(xml))
xmljson.parker.etree({'ul': {'li': [1, 2]}})
Converting XML to JSON using Python?