My Tornado application accepts POST data through http body request
In my handler I am able to get the request
def post(self):
data = self.request.body
The data I am getting is in the from of str(dictionary)
Is there a way to receive this data in the form of a Python dictionary?
I don't want to use eval
on the server side to convert this string to a Python dictionary.
As an alternative to Eloim's answer, Tornado provides tornado.escape for "Escaping/unescaping HTML, JSON, URLs, and others". Using it should give you exactly what you want:
data = tornado.escape.json_decode(self.request.body)