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 more or less have been tinkering with. If anyone can put A & B together, I would be SO greatful. I'm freaking lost.
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)