'Write data in JSON format to a file'

def write_to_cache(self, data, filename):

    json_data = json_format_dict(data, True)
    cache = open(filename, 'w')
    cache.write(json_data)
    cache.close()
