def json_in(content_type=[ntou('application/json'), ntou('text/javascript')], force=True, debug=False, processor=json_processor):
 request = cherrypy.serving.request
 if isinstance(content_type, text_or_bytes):
  content_type = [content_type]
 if force:
  if debug:
   cherrypy.log(('Removing body processors %s' % repr(request.body.processors.keys())), 'TOOLS.JSON_IN')
  request.body.processors.clear()
  request.body.default_proc = cherrypy.HTTPError(415, ('Expected an entity of content type %s' % ', '.join(content_type)))
 for ct in content_type:
  if debug:
   cherrypy.log(('Adding body processor for %s' % ct), 'TOOLS.JSON_IN')
  request.body.processors[ct] = processor

def json_in ( content_type = [ ntou ( 'application/json' ) , ntou ( 'text/javascript' ) ] , force = True , debug = False , processor = json_processor ) : request = cherrypy . serving . request if isinstance ( content_type , text_or_bytes ) : content_type = [ content_type ] if force : if debug : cherrypy . log ( ( 'Removing body processors %s' % repr ( request . body . processors . keys ( ) ) ) , 'TOOLS.JSON_IN' ) request . body . processors . clear ( ) request . body . default_proc = cherrypy . HTTPError ( 415 , ( 'Expected an entity of content type %s' % ', ' . join ( content_type ) ) ) for ct in content_type : if debug : cherrypy . log ( ( 'Adding body processor for %s' % ct ) , 'TOOLS.JSON_IN' ) request . body . processors [ ct ] = processor
add a processor to parse json request entities: the default processor places the parsed data into request .