cherrypy json 解析

接收json
class Root(object):
    @cherrypy.expose
    @cherrypy.tools.json_in()
    def index(self):
        data = cherrypy.request.json
        print(data)
 
返回json
import cherrypy
 
class Root(object):
    @cherrypy.expose
    @cherrypy.tools.json_out()
    def index(self):
        return {'key': 'value'}
 
if __name__ == '__main__':
    cherrypy.quickstart(Root()) 

原文地址:https://www.cnblogs.com/sea-stream/p/14179411.html