import json


def write_to_json_file(obj, filename):
    """
    Write on file filename the object in JSON format

    :param obj: object to be written on the JSON file
    :param filename: filename to be used to store the obj
    :return: success (bool)
    """

    f = open(filename, "w")
    try:
        json.dump(obj, f)
        success = True
    except:
        success = False
    finally:
        f.close()
    return success