Useful for restful APIs
        :param data: a native python object, must be json serialiable, otherwise will be handled by :py:meth:`Application.json_handle_weird`
        :param code: the http status code
        :param indent: how many characters to indent when generating the json
        :param headers: a dict with optional headers
        :returns: a :py:class:`flask.Response` with the option of prettifying
        the json response

def json_response(self, data, code=200, indent=2, headers={}):
        """Useful for restful APIs
        :param data: a native python object, must be json serialiable, otherwise will be handled by :py:meth:`Application.json_handle_weird`
        :param code: the http status code
        :param indent: how many characters to indent when generating the json
        :param headers: a dict with optional headers
        :returns: a :py:class:`flask.Response` with the option of prettifying
        the json response
        """
        headers = headers.copy()
        headers['Content-Type'] = 'application/json'
        payload = json.dumps(data, indent=indent, default=self.json_handle_weird)
        return Response(payload, status=code, headers=headers)