January 4th, 2013, 07: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, 12:00 PM
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 12:04 PM.
Reason: Found additional method