<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def json_dump_hook(cfg, text: bool=False):
 """ Dumps all the data into a JSON file. """

    data = cfg.config.dump()

    if not text:
        json.dump(data, cfg.fd)
    else:
        return json.dumps(data)