I am attempting to write a JSONP application and think that it is not working because the JSON my code is returning has surrounding quotation marks.
For example when I call the webapp using http://rest-client.googlecode.com/ it returns the following
"callbackfunctionname({'Last': 'Doe', 'First': 'John'})"
Comparing this to a public url I am using which works the only difference I can see is the surrounding quotation marks.
Does anybody know how I can remove these?
Thanks
Jim
def get(self):
json = "{'Last': 'Doe', 'First': 'John'}"
json = self.request.get("callback") + '(' + json + ')'
logging.debug("json=" + json)
self.response.set_status(200)
self.response.headers['Content-Type'] = "application/json"
self.response.headers['Content-Length'] = len(json)
self.response.content_type = "application/json"
simplejson.dump(json, self.response.out)