# -*- coding: utf-8 -*-
"""
json to yaml converter
"""
import yaml

from deserialize_json import DeserializeJson

class ConvertJsonToYaml:
    @staticmethod
    def run(deserializeddata, destinationfilelocaiton):
        if type(deserializeddata) is str and deserializeddata.endswith('.json'):
            deserializeddata = DeserializeJson(deserializeddata)
        if type(deserializeddata) is DeserializeJson:
            deserializeddata = deserializeddata.data
        with open(destinationfilelocaiton, 'w', encoding='utf-8') as f:
            yaml.dump(deserializeddata, f, allow_unicode=True)
        print("it is done")