<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_json(domain, action, filename=False, record=False):
 """Convert text file to JSON. Arguments: domain: domain name of updating target action: True ; for PUT/POST HTTP method False; for DELETE HTTP method filename: text file of bulk updating (default is False) record: json record of updating single record (default is False) """

    o = JSONConverter(domain)

    if filename:
        # for 'bulk_create/bulk_delete'
        with open(filename, 'r') as f:
            o.separate_input_file(f)
            for item in o.separated_list:
                o.read_records(item.splitlines())
                o.generata_data(action)

    elif record:
        # for 'create/delete'
        o.read_records(record)
        o.generata_data(action)

    return o.dict_records