'Writes data in JSON format to a file'

def write_cache(self):

    json_data = self.json_format_dict(self.inventory, True)
    cache = open(self.cache_path, 'w')
    cache.write(json_data)
    cache.close()
