Search code examples
pythonpython-2.7tornado

How to fetch JSON argument in Tornado's POST handler?


From client I generate post request and in body I have simlpe JSON like

{
    "action": "copy_all",
    "id": "aabbababab",
    "factory_id": 12297829382473034000
}

How to fetch this argument this in handler (post function) ? I know how to parse when I send like key/value pair and get argument by key, but here JSON is one argument.


Solution

  • use:

    data = tornado.escape.json_decode(self.request.body)