I have an XML file that I want to convert to a JSON file using python, but its nt works for me.
<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
In the XML file above, I parse with ElementTree and provide it with Simplejson for serialization as follows:
from xml.etree import ElementTree as ET import simplejson tree = ET.parse(Xml_file_path) simplejson.dumps(tree)
This gives me an error: TypeError: xml.etree.ElementTree.ElementTree object at 0x00C49DD0 is not serializable JSON.
source share