Return an object's representation as JSON

def as_json(context):
    """Return an object's representation as JSON"""
    info = {
        'info': cgi.escape(pprint.pformat(context.context)),
    }
    return Response(content_type='application/json', body=json.dumps(info))