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?



def get(self):

json = "{'Last': 'Doe', 'First': 'John'}"
		json = self.request.get("callback") + '(' + json + ')'
		logging.debug("json=" + json)
		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)

The function s.strip() will do ...

s = repr("callbackfunctionname({'Last': 'Doe', 'First': 'John'})")

print s
# remove leading and trailing character '"'

my output -->
"callbackfunctionname({'Last': 'Doe', 'First': 'John'})"
callbackfunctionname({'Last': 'Doe', 'First': 'John'})