January 4th, 2013, 06:50 AM
XML to Json convert
i have a question toJson conversion. I am parsing a huge XML file with lxml and i pass it to a variable. After that i would like to convert that object that .parse create to Json.
from lxml import etree
inFile = 'file:///home/vasgen/Projects/hackathon/docs/samples/PriceXplorer_XTRSearch_4MB.xml'
xmlData = etree.parse(inFile)
I tryied with jsonlib but with no result.
Does anyone know how to export xmlData var to Json??
I want to add that i am tottaly new to Python.
Thanks in advance
January 4th, 2013, 11:00 AM
Best I could find without resorting to writing my own parser:
If I was going to write my own though I would use:
in case I needed to adjust any of the data in between processes and then serialise to json using the json module.
Hope this helps.
Last edited by zilog6502; January 4th, 2013 at 11:04 AM.
Reason: Found additional method