def render_json(data, filename=None, response=response): encoding = 'utf-8' # RFC 4627.3 response.content_type = 'application/json' response.content_encoding = encoding if filename is not None: response.content_disposition = 'attachment; filename="'\ + filename.replace('"', '_') + '"' return json_dumps(data, encoding=encoding)
def render_json(data, encoding='utf-8'): response.content_type = 'text/javascript' response.content_encoding = encoding return json_dumps(data, encoding=encoding)