Possible Duplicate:
Converting XML to JSON using Python?
I'm doing some work on App Engine and I need to convert an XML document being retrieved from a remote server into an equivalent JSON object.
I'm using xml.dom.minidom to parse the XML data being returned by urlfetch. I'm also trying to use django.utils.simplejson to convert the parsed XML document into JSON. I'm completely at a loss as to how to hook the two together. Below is the code I'm tinkering with:
from xml.dom import minidom
from django.utils import simplejson as json
#pseudo code that returns actual xml data as a string from remote server. 
result = urlfetch.fetch(url,'','get');
dom = minidom.parseString(result.content)
json = simplejson.load(dom)
self.response.out.write(json)
 
     
     
     
     
     
     
     
     
    