def jsonify ( resource ) : response = flask . jsonify ( resource . to_dict ( ) ) response = add_link_headers ( response , resource . links ( ) ) return response
python flask jsonify example
Return a Flask Response object containing a JSON representation of * resource * .
def jsonify(resource):
    """Return a Flask ``Response`` object containing a
    JSON representation of *resource*.

    :param resource: The resource to act as the basis of the response
    """

    response = flask.jsonify(resource.to_dict())
    response = add_link_headers(response, resource.links())
    return response